久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

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

      php如何刪除字符串中的重復(fù)數(shù)字或字符

      php如何刪除字符串中的重復(fù)數(shù)字或字符

      利用php刪除字符串中重復(fù)字符。

      比如:$str = "aaadddd"最后得到的應(yīng)該是"ad"。

      思路:

      遍歷整個(gè)數(shù)組,然后依次取出第i個(gè)字符,存入一個(gè)臨時(shí)數(shù)組中,同時(shí)遍歷臨時(shí)數(shù)組,查找該數(shù)組中是否已經(jīng)存在該字符。

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

      代碼如下:

      $b = 'aaaaaaaaaaaaddddddttttttffff';   $tmp = array();   for($i = 0; $i < strlen($b); $i++){           $len = count($tmp);               for($j = 0; $j < $len; $j++){                   if($b[$i] === $tmp[$j]){                          break;                   }           }       if($j == $len){  //如果最后的$j和$len相等的話,則表示$tmp臨時(shí)數(shù)組中不存在$b[$i]               $tmp[] = $b[$i];       }   }   $result = implode($tmp);   //輸出adtf

      相關(guān)文章教程推薦:php基礎(chǔ)教程

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