I need help in converting preg_replace to preg_replace_callback.
PHP 5.4 and above firing the following statement:
The /e modifier is deprecated, use preg_replace_callback instead in
I've tried changing:
if (stripos ( $tpl->copy_template, "[category=" ) !== false) {
$tpl->copy_template = preg_replace ( "#\\[category=(.+?)\\](.*?)\[/category\\]#ies", "check_category('\\1', '\\2', '{$category_id}')", $tpl->copy_template );
}
to
if (stripos ( $tpl->copy_template, "[category=" ) !== false) {
$tpl->copy_template = preg_replace_callback ( "#\\[category=(.+?)\\](.*?)\\[/category\\]#isu",
function($cat){
return check_category($cat['1'], $cat['2'], $category_id);
}
, $tpl->copy_template );
}
the return is empty
check_categorydo?function check_category($cats, $block, $category, $action = true) {..}