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){ $c = preg_replace('~\$(\d)~', '$m[$1]', $s); print "\n$c\n"; return eval($c); }, $s); } return $s; } function waa($t){ return '*'.$t.'*'; } } var_dump((new x)->p('wazup'));
based on GJDmM
Output for 7.0.0 - 7.2.0
wazup Parse error: syntax error, unexpected end of file in /in/tFM1V(17) : eval()'d code on line 1
Process exited with code 255.
Output for 5.4.11 - 5.6.28
wazup Parse error: syntax error, unexpected end of file in /in/tFM1V(17) : eval()'d code on line 1 wazup Parse error: syntax error, unexpected end of file in /in/tFM1V(17) : eval()'d code on line 1 wazup Parse error: syntax error, unexpected end of file in /in/tFM1V(17) : eval()'d code on line 1 wazup Parse error: syntax error, unexpected end of file in /in/tFM1V(17) : eval()'d code on line 1 wazup Parse error: syntax error, unexpected end of file in /in/tFM1V(17) : eval()'d code on line 1 string(0) ""
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/tFM1V on line 5
Process exited with code 255.