开发者

Convert eregi function to php 5.3 [duplicate]

开发者 https://www.devze.com 2023-03-10 03:26 出处:网络
This que开发者_高级运维stion already has answers here: Closed 10 years ago. Possible Duplicate: How can I convert ereg expressions to preg in PHP?
This que开发者_高级运维stion already has answers here: Closed 10 years ago.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号