preg_replace_callback not working
-
I’ve a problem inside my block frontend code (php)
In this case ‘query’ attribute is ‘AUTH:{AUTH}’
<?php
$query = $attributes[‘query’];
$q = preg_replace_callback(‘/{(\w+)}/’, function($matches) {
return $matches[1];
}, $query);
echo ‘<div>’.$q.'</div>’;
}
?>This code is not working.
I tried the above code in more than one php playground and it’s working correctly.
The result to the above snippet must be that $q is ‘AUTH:AUTH’.
This is a simplified case, the above inline function must return a more complex value.Thanks.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘preg_replace_callback not working’ is closed to new replies.