位置:首頁 > 軟件操作教程 > 編程開發(fā) > PHP > 問題詳情

PHP preg_match()和preg_match_all()函數(shù)

提問人:劉團圓發(fā)布時間:2021-01-13

    函數(shù)語法:

    int preg_match/preg_match_all(string pattern, string subject[,array matches])

    函數(shù)功能:在字符串subject中匹配表達式pattern。函數(shù)返回匹配的次數(shù)。如果有數(shù)組matches,那么每次匹配的結(jié)果都將被存儲到數(shù)組matches中。

    函數(shù)preg_matCh()的返回值是0或1。因為該函數(shù)在匹配成功后就停止繼續(xù)查找了。而preg_match_all()函數(shù)則會一直匹配到最后才會停止。參數(shù)array matches對于preg_match_all()函數(shù)是必須有的,而對前者則可以省略。

繼續(xù)查找其他問題的答案?

相關(guān)視頻回答
回復(fù)(0)
返回頂部