RE: [PHP] Which is faster?
| From: | John W. Holmes | Date: | Fri, 22 Nov 2002 01:35:47 +0000 |
| Subject: | RE: [PHP] Which is faster? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-125543@lists.php.net to get a copy of this message | ||
> I'm wondering which is faster, eregi('[A-Z]',$variable); or
> ereg('A-Za-z',$variable);?
Well, you're not even matching the same thing, for one...
And, second, why not read this page, www.php.net/microtime so you can do
your own testing in the future?
They run about the same in my tests, assuming you're looking for
[a-zA-Z] in the second example. Even preg_match ran about the same
speed.
I'd recommend you do your own testing in your actual program though.
Generally, preg_* is faster than ereg* but it depends on what you're
actually doing.
---John Holmes...