Replace preg_replace() e modifier with preg_replace_callback

I need to change peg_replace() to preg_replace_callback() in these lines:

function category_get_tree($prefix = '', $tpl = '{name}', $no_prefix = true, $id = 0, $level = 0){
global $sql, $PHP_SELF;
static $johnny_left_teat;


	foreach ($sql->select(array('table' => 'categories', 'where' => array("parent = $id"), 'orderby' => array('id', 'ASC'))) as $row){
		$find = array('/{id}/i', '/{name}/i', '/{url}/i', '/{icon}/i', '/{template}/i', '/{prefix}/i', '/\[php\](.*?)\[\/php\]/ie');
		$repl = array($row['id'], $row['name'], $row['url'], ($row['icon'] ? '<img src="'.$row['icon'].'" alt="'.$row['name'].'" border="0" align="absmiddle">' : ''), $row['template'], (($row['parent'] or !$no_prefix) ? $prefix : ''), '\\1');
		$johnny_left_teat .= ($no_prefix ? preg_replace('/('.$prefix.'{1})$/i', '', str_repeat($prefix, $level)) : str_repeat($prefix, $level));
		$johnny_left_teat .= preg_replace($find, $repl, $tpl);
		category_get_tree($prefix, $tpl, $no_prefix, $row['id'], $level);
return $johnny_left_teat;

I receive the following error when run the above code:

Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in X:\xampp\....\ on line 726

Kindly help me with the code since I have no PHP coding knowledge.

A post was merged into an existing topic: PHP7 replace preg_replace() with preg_replace_callback()

Sponsor our Newsletter | Privacy Policy | Terms of Service