亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

    php如何隱藏手機(jī)號(hào)中間四位

    php隱藏手機(jī)號(hào)中間四位的方法:1、字符串截取法【$new_tel1=substr($tel, 0, 3).'****'.substr($tel, 7)】;2、替換字符串的子串【$new_tel=substr_replace($tel)】。

    php如何隱藏手機(jī)號(hào)中間四位

    【相關(guān)學(xué)習(xí)推薦:php編程(視頻)】

    php隱藏手機(jī)號(hào)中間四位的方法:

    $num = "12345678910" $str = substr_replace($num,'****',3,4);

    php如何隱藏手機(jī)號(hào)中間四位

    三種實(shí)現(xiàn)方式

    <?php $tel = '12345678910'; //1.字符串截取法 $new_tel1 = substr($tel, 0, 3).'****'.substr($tel, 7); var_dump($new_tel1); //2.替換字符串的子串 $new_tel2 = substr_replace($tel, '****', 3, 4); var_dump($new_tel2); //3.用正則 $new_tel3 = preg_replace('/(d{3})d{4}(d{4})/', '$1****$2', $tel); var_dump($new_tel3); ?>

    結(jié)果:

    > string(11) "123****8910" > string(11) "123****8910" > string(11) "123****8910"

    想了解

    贊(0)
    分享到: 更多 (0)
    網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)