preg_replace is faster than str_replace on PHP 7.x.x #216
gigamaster
started this conversation in
General
Replies: 1 comment
-
This is include interesting things. I think that result reason is maintainance activity. The str_* functions only maintenance by php community. preg_* is maintenance by php+perl community. So more reviced in preg_* functions. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Test converting all instances of http:// to https://
It seeems that preg_replace is 2x faster on PHP 7.x.x
PHP online
Result PHP 7.x
preg_replace: 0.0252 seconds
str_replace: 0.0541 seconds
Result PHP 5.6
preg_replace: 0.0346 seconds
str_replace: 0.0201 seconds
Beta Was this translation helpful? Give feedback.
All reactions