3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class x { public $a = [ '~.~' => '$this->waa($0);' ]; function p($s) { foreach($this->a as $p => $r) { $s = preg_replace_callback($p, function($m) use ($s, $r){ $c = preg_replace('~\$(\d)~', '$m[$1]', $r); print "\n$c\n"; return eval('return '.$c); }, $s); } return $s; } function waa($t){ return '*'.$t.'*'; } } var_dump((new x)->p('wazup'));
based on DFqWd
Output for 5.4.11 - 7.2.0
$this->waa($m[0]); $this->waa($m[0]); $this->waa($m[0]); $this->waa($m[0]); $this->waa($m[0]); string(15) "*w**a**z**u**p*"
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/t6ec6 on line 5
Process exited with code 255.