Convert eregi function to php 5.3 [duplicate]
Possible Duplicate:
How can I convert ereg expressions to preg in PHP?
How do i convert this code to php 5.3:
if (eregi("VERIFIED",$this->ipn_response)) { }
if (preg_match("/VERIFIED/i",$this->ipn_response)) { }
If you are looking for a fixed text like VERIFIED
you shouldn't use regular expressions because they use unnecessary overhead.
if(stripos('VERIFIED', $this->ipn_response) !== false) { }
That should also do the job. Note that stripos()
returns the position of the string you are looking for, so it could return zero to indicate a match. It returns boolean false if the string you are looking for is not present.
精彩评论