2

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)) { }
Community
  • 1
  • 1
Carlos Barbosa
  • 1,422
  • 2
  • 23
  • 42

2 Answers2

6
if (preg_match("/VERIFIED/i",$this->ipn_response)) { }
Yuri Stuken
  • 12,820
  • 1
  • 26
  • 23
5

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.

Arjan
  • 9,784
  • 1
  • 31
  • 41