Home >Backend Development >PHP Tutorial >The difference between PHP function eregi() and ereg() in practical applications_PHP tutorial
The following is an example to illustrate the difference between the PHP functions eregi() and ereg():
Look for the capital letter C in abcdef
<ol class="dp-xml"><li class="alt"><span><span class="tag"><</SPAN><SPAN> ?php </SPAN></SPAN><LI><SPAN>if (ereg("C","abcdef")){ </SPAN><LI class=alt><SPAN> echo "通过"; </SPAN><LI><SPAN>}else{ </SPAN><LI class=alt><SPAN> echo "错误"; </SPAN><LI><SPAN>} </SPAN><LI class=alt><SPAN class=tag>?></span><span> </span></span></li></ol>
//Return The result is: Error
<ol class="dp-xml"><li class="alt"><span><span class="tag"><</SPAN><SPAN> ?php </SPAN></SPAN><LI><SPAN>if (eregi("C","abcdef")){ </SPAN><LI class=alt><SPAN> echo "通过"; </SPAN><LI><SPAN>}else{ </SPAN><LI class=alt><SPAN> echo "错误"; </SPAN><LI><SPAN>} </SPAN><LI class=alt><SPAN class=tag>?></span><span> </span></span></li></ol>
//The return result is:
ereg() is case-sensitive, and the PHP function eregi() is case-independent.