- var_dump: documentation ( source)
- preg_replace: documentation ( source)
<?php
function fox( $a) { return $a . 'fox!'; }
function dog( $b) { return $b . 'dog!'; }
$a = 'A'; $b = 'B';
$string = 'The quick brown {{fox($a);}} jumped over the lazy {{dog($b);}}.';
$regex = '/{{([^}]+)+}}/e';
$result = preg_replace( $regex, '$1', $string);
var_dump( $matches);