Ticker

6/recent/ticker-posts

Ad Code

Responsive Advertisement

Deprecated: preg_replace(): the /e modifier is deprecated, use preg_replace_callback instead in

Deprecated: preg_replace(): the /e modifier is deprecated, use preg_replace_callback instead in – What’s happening?

When you upgrade the PHP to the 5.5 version, the preg_replace modifier /e won’t be used anymore. Therefore, if you try to utilize it, a deprecated message will appear: Deprecated: preg_replace(): the /e modifier is deprecated, use preg_replace_callback instead in. So, what do you need to do in this situation? In the blog today, we would like to bring you a wonderful solution to address the trouble. Let’s follow some simple steps below now!

How to solve the Deprecated: preg_replace(): the /e modifier is deprecated, use preg_replace_callback instead in

In order to deal with the issue, you just need to use an anonymous function to make it suitable for your function.

For example, the old version:

$uppercaseValue = preg_replace(
'/(^|_)([a-z])/e',
'strtoupper("\\2")',
$string
);

Now, you need simply change it into the new following version:

$uppercaseValue = preg_replace_callback(
'/(^|_)([a-z])/',
function($matches) { return strtoupper($matches[2]); },
$string
);

In our example, we alter preg_replace( into preg_replace_callback( . Besides that, instead of using //2, we will use $matches[2].

Wrap Up

In conclusion, we think with the steps above, the trouble will be addressed easily and effectively. If you believe the blog is useful, then why don’t you share it with your friends? Besides, any idea to tackle it? Let us know by leaving your comment in the box below. Furthermore, don’t forget to follow us because we will come back with many handy troubleshooting blogs. Last but not least, let’s take a look at our Free WordPress Themes and get the best one for your site. Hope you enjoy the blog today and have a great day. Thanks for your reading.

Rate for post

The post Deprecated: preg_replace(): the /e modifier is deprecated, use preg_replace_callback instead in appeared first on LTHEME.

Enregistrer un commentaire

0 Commentaires