Favor str_replace() Over ereg_replace() and preg_replace() - PHP Views : 388
Tagged in : PHP
0 0
Send mail
Favor str_replace() Over ereg_replace() and preg_replace()

If you’re using regular expressions, then ereg_replace() and preg_replace() will be much faster than str_replace().

Because str_replace() does not support pattern matching, this statement makes no sense. The choice between string functions and regular expression functions comes down to which is fit for purpose, not which is faster.

If you need to match a pattern, use a regular expression function. If you need to match a string, use a string function.

By Sanju, On - 2010-01-01



    Login to add Comments .