|
Posted by Andrew Cameron on 03/31/06 20:51
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/
[Back to original message]
|