Rumah >pembangunan bahagian belakang >tutorial php >PHP函数eregi()在实际应用中与ereg()的不同之处_PHP教程
下面举例说明这PHP函数eregi()和ereg()函数的区别:
在abcdef中查找是否含有大写字母C
<ol class="dp-xml"><li class="alt"><span><span class="tag"><span> ?php </span></span><li><span>if (ereg("C","abcdef")){ </span></li> <li class="alt"><span> echo "通过"; </span></li> <li><span>}else{ </span></li> <li class="alt"><span> echo "错误"; </span></li> <li><span>} </span></li> <li class="alt"> <span class="tag">?></span><span> </span> </li></span></li></ol>
//返回结果是:错误
<ol class="dp-xml"><li class="alt"><span><span class="tag"><span> ?php </span></span><li><span>if (eregi("C","abcdef")){ </span></li> <li class="alt"><span> echo "通过"; </span></li> <li><span>}else{ </span></li> <li class="alt"><span> echo "错误"; </span></li> <li><span>} </span></li> <li class="alt"> <span class="tag">?></span><span> </span> </li></span></li></ol>
//返回结果是:通过
ereg() 有区分大小写,PHP函数eregi()与大小写无关。