Page 1 of 1

help with php5 error

Posted: Sat Feb 20, 2016 11:48 am
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;
}

Re: help with php5 error

Posted: Sat Feb 20, 2016 12:57 pm
by Christopher
Did you look at the example in the manual: http://php.net/manual/en/function.preg- ... llback.php