help with php5 error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jantoine55
Forum Newbie
Posts: 1
Joined: Sat Feb 20, 2016 11:43 am

help with php5 error

Post by jantoine55 »

I got an error saying: PHP Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in

Can someone help me with this code:

Code: Select all

function __($text, $array) {
	$text = preg_replace("/\{(\w+)\}/e", "\$array[strtolower('$1')]", $text);
	return $text;
}
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: help with php5 error

Post by Christopher »

Did you look at the example in the manual: http://php.net/manual/en/function.preg- ... llback.php
(#10850)
Post Reply