久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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)站

      php如何去除字符串中數(shù)字

      php去除字符串中數(shù)字的方法:首先創(chuàng)建一個(gè)PHP示例文件;然后使用“$class=preg_replace("/\d+/",'', $res);”方法去除字符串中數(shù)字即可。

      php如何去除字符串中數(shù)字

      推薦:《PHP視頻教程》

      PHP去掉字符串中的數(shù)字

      這個(gè)比較簡(jiǎn)單,但是也有些需要注意的地方,先貼代碼

      $class=preg_replace("\d+",'', $res);

      需要使用preg_replace函數(shù),但是只是這么寫的話,會(huì)報(bào)錯(cuò)

      Warning: preg_replace(): Delimiter must not be alphanumeric or backslash

      翻譯過(guò)來(lái)就是定界符不能是字母數(shù)字或反斜線。

      想了一下,在正則表達(dá)式首尾加了一對(duì)/

      $class=preg_replace("/\d+/",'', $res);

      這樣就成功了

      相關(guān)介紹:

      preg_replace 函數(shù)執(zhí)行一個(gè)正則表達(dá)式的搜索和替換。

      語(yǔ)法

      mixed preg_replace ( mixed $pattern , mixed $replacement , mixed $subject [, int $limit = -1 [, int &$count ]] )

      搜索 subject 中匹配 pattern 的部分, 以 replacement 進(jìn)行替換。

      參數(shù)說(shuō)明:

      $pattern: 要搜索的模式,可以是字符串或一個(gè)字符串?dāng)?shù)組。

      $replacement: 用于替換的字符串或字符串?dāng)?shù)組。

      $subject: 要搜索替換的目標(biāo)字符串或字符串?dāng)?shù)組。

      $limit: 可選,對(duì)于每個(gè)模式用于每個(gè) subject 字符串的最大可替換次數(shù)。 默認(rèn)是-1(無(wú)限制)。

      $count: 可選,為替換執(zhí)行的次數(shù)。

      返回值

      如果 subject 是一個(gè)數(shù)組, preg_replace() 返回一個(gè)數(shù)組, 其他情況下返回一個(gè)字符串。

      如果匹配被查找到,替換后的 subject 被返回,其他情況下 返回沒(méi)有改變的 subject。如果發(fā)生錯(cuò)誤,返回 NULL。

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