|
|
Favor str_replace() Over ereg_replace() and preg_replace() - PHP
|
Views : 388
|
|
Tagged in : PHP
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
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 |
|
|
|