Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback

萝らか妹 提交于 2021-02-11 15:14:42

问题


I can not fix this error:

$match[1] = preg_replace('/(?<=^|[a-z])./e', 'strtoupper("\0")', strtolower(trim($match[1])));

How to change it?


回答1:


You should read the manual. The e modifier is deprecated and will be removed in further versions. Just use preg_replace_callback (the message told you..)

$match[1] = preg_replace_callback('/(?<=^|[a-z])./', function($m) {
    return strtoupper($m[0]);
}, strtolower(trim($match[1])));


来源:https://stackoverflow.com/questions/33539495/deprecated-preg-replace-the-e-modifier-is-deprecated-use-preg-replace-call

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!