Can somebody help me with this error I'm getting?
Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
My original code:
$match[1] = preg_replace('/(?<=^|[\x09\x20\x2D])./e', 'strtoupper("\0")', strtolower(trim($match[1])));
So I tried it like this:
$match[1] = preg_replace_callback('/(?<=^|[\x09\x20\x2D])./e',
function ($matches) {
foreach ($matches as $match) {
return strtoupper($match);
}
},
strtolower(trim($match[1])));
But I'm still getting the same error:
Warning: preg_replace_callback(): The /e modifier is no longer supported, use preg_replace_callback instead
e
modifier has no more sense in yourpreg_replace_callback()
code. Remove it. Then areturn
inforeach
will stop the loop at the first iteration. – Attaint