RE: [PHP] IF statement question...
| From: | Michael Sims | Date: | Wed, 19 May 2004 15:52:13 +0000 |
| Subject: | RE: [PHP] IF statement question... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-186543@lists.php.net to get a copy of this message | ||
Jay Blanchard wrote:
> [snip]
> strpos() : 0.18918436765671
> preg_match() : 0.26665662288666
> [/snip]
>
> 1/3rd of a second slower....interesting. You know what though, my
> original assertion is correct....almost any of the regex functions
> will work.
Personally, I prefer using preg_match() 9 times out of 10 vs. strpos(), strstr(),
etc. Whatever performance penalty I pay for doing this is a statistical drop in the
bucket compared to the overhead of, say, opening a connection to a database (which
nearly all of my pages do). I'm also a perl guy so regex's are more natural to me
to read and write so I tend to favor them...