[geeklog-devel] Regex functions in Geeklog

Tony Bibbs tony at tonybibbs.com
Mon Mar 8 09:05:02 EST 2004


An anonymous coward wrote:

<snip>
I was looking through the Geeklog PHP code and saw it uses functions
like eregi and ereg_replace in places, when it should be using
preg_match or str_replace, which are much faster.  I've been coding in
PHP since '99 and I've benchmarked the preg and string functions against
the ereg functions and the ereg functions are always slower and should
never be used.  You should use strstr or stristr instead of ereg or
preg_match if you don't need a regular expression.  And you should use
str_replace instead of preg_replace or ereg_replace if you don't need a
regular expression.

Please consider making these changes in future versions of the code.
</snip>

I've forward this to the list as an FYI.  This guy isn't saying 
something we haven't heard before.  BTW, for anybody watching this list, 
anonymously sent emails annoy me (and other developers I'm sure).  Use 
geeklog-devtalk or geeklog-users for stuff like this.

--Tony



More information about the geeklog-devel mailing list