3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class x { public $a = [ '~.~' => '$this->waa($0);' ]; function __construct($s) { foreach($this->a as $p => $r) { $s = preg_replace_callback($p, function($m) use ($s){ return eval( preg_replace('~\$(\d)~', '$m[$1]', $s) ); }, $s); } return $s; } function waa($t){ return '*'.$t.'*'; } } var_dump(new x('wazup'));
based on BSEgr