Almost every working example I have seen uses the 2nd example you have. I have implemented it and it works great. I haven't noticed any performance issues at all either.
Oh except I am using createMatcher not createPlainMatcher, it gives you a second variable if you need it.
pattern = createMatcher(@swapMe('passMe'))
will return passMe in $2 of pattern
preg_replace($pattern, '$1'.$replace.'$2', $value); });
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community