Re: eregi alternatives



Jesper wrote:
if ( strpos($string, "text") !== false ) { print "found";}

Is that the best solution?

Well, I did some tests, and on my local machine (2.1Ghz Athlon, 512MB RAM):

1 million x substr_count('haystack', 'stack'): 2.2226340770721 seconds
1 million x strpos('haystack', 'stack'): 2.0917880535126 seconds
1 million x eregi('stack', 'haystack'): 4.2442169189453 seconds

So basically yes. Well done. :-)

--
Regards,
Andrew Cameron
http://dumpage.net/
.