PHP Tip #6: str_replace Is Faster
This is probably a very well known tip, but for those new to PHP it’s handy. When needing to replace something try & use str_replace
instead of preg_replace
. Always remember that REGEX is costly & should only be used when it is really needed. If you need to do a case insensitive replace then use str_ireplace
.
1 Comment
Jason
Great post very well said, and very informative thanks!