Re: Fastest way to find out if a string contains a certain character?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Peter Lind wrote:

> strstr() returns a string, not a bool
> - which would make it slower, though again, not noticeably so (unless,
> like Ashley points out, you're doing a HUGE number of strstr() calls).

Thanks, both of you. Using strpos saved me 200ms. It wasn't really that
I expected to save a lot of time, more that I was interested to know so
that I do the right thing in the future, since the meaning of the code
is not clearer using one way or the other (i.e. I have to write a
comment either way). And yes, I'd already realised using regex was a bad
idea :)


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux