Re: Sanitizing Numbers
| From: | Robert Cummings | Date: | Fri, 13 Mar 2009 19:45:36 +0000 |
| Subject: | Re: Sanitizing Numbers | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-290016@lists.php.net to get a copy of this message | ||
On Fri, 2009-03-13 at 19:09 +0000, Richard Heyes wrote:
> > ereg
>
> [Gasps and runs off shouting "PCRE"] ...
You know... Until somewhat recently I preferred POSIX over PCRE...
rationale being it's "POSIX" that's a standard!!! But recently I came
across some legacy code in a site I maintain that was using ereg(). It
just so happened I was tracking down another bug and so I was doing some
timestamp squeezing to find the problem when I discovered a horrible
horrible thing... a few preg() calls with capturing were resposible for
50% of the page load time. I changed them to preg_match() and I cut the
page time in half since the preg_match() time was negligible. I now much
prefer to use preg_xxx() functions since I have concrete evidence of
their superiority.
Cheers,
Rob.
Ps. The docs always said that ereg() was a bit slower... they didn't say
it was severely debilitating.
--
http://www.interjinn.com
Application and Templating Framework for PHP