久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      對(duì)php中str_replace()函數(shù)的詳解

      str_replace()的語(yǔ)法:

      str_replace mixed $search  ,mixed $replace, mixed $subject [, int &$count  ] ) : mixed

      1.search ,replace都是字符串

      <?php  $bodytag = str_replace("%body%", "black", "<body text='%body%'>"); echo $bodytag; //輸出:<body text='black'> ?>

      2.search是數(shù)組 ,replace是字符串

      <?php  $vowels = array("a", "e", "i", "o", "u", "A", "E", "I", "O", "U"); $onlyconsonants = str_replace($vowels, "", "Hello World of PHP"); echo $onlyconsonants;// 輸出: Hll Wrld f PHP ?>

      3.search ,replace都是數(shù)組

      <?php $phrase  = "You should eat fruits, vegetables, and fiber every day."; $healthy = array("fruits", "vegetables", "fiber"); $yummy   = array("pizza", "beer", "ice cream"); $newphrase = str_replace($healthy, $yummy, $phrase); //輸出:You should eat pizza, beer, and ice cream every day ?>

      4.含有第三個(gè)參數(shù)

      <?php $str = str_replace("ll", "", "good golly miss molly!", $count); echo $count;// 賦值: 2 ?>

      ps: search ,replace的第一組替換會(huì)影響到第二組,如下

      $search  = array('A', 'B', 'C', 'D', 'E'); $replace = array('B', 'C', 'D', 'E', 'F'); $subject = 'A'; echo str_replace($search, $replace, $subject)."<br/>"; // 輸出 F ,因?yàn)?A 被 B 替換,B 又被 C 替換,以此類(lèi)推... // 由于從左到右依次替換,最終 E 被 F 替換

      推薦:php視頻教程 php7教程

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