3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class x { public $a = [ '~.~e' => '$this->waa($0);' ]; function p($s) { foreach($this->a as $p => $r) { // support deprecated PREG_REPLACE_EVAL if (preg_match('~^(.*)([/\~])([imsxADSUXJu]*)e([imsxADSUXJu]*)$~s', $p, $m)) { $s = preg_replace_callback($m[1].$m[2].$m[3].$m[4], function($m) use ($s, $r){ return eval('return '. preg_replace_callback('~\$(\d)~', function($i) use($m){ return $m[ $i[1] ];}, $r).';'); }, $s); } else $string = preg_replace($p, $r, $s); } return $s; } function waa($t){ return '*'.$t.'*'; } } var_dump((new x)->p('wazup'));
based on t6ec6
Output for 7.2.0
Warning: Use of undefined constant w - assumed 'w' (this will throw an Error in a future version of PHP) in /in/c9ITE(17) : eval()'d code on line 1 Warning: Use of undefined constant a - assumed 'a' (this will throw an Error in a future version of PHP) in /in/c9ITE(17) : eval()'d code on line 1 Warning: Use of undefined constant z - assumed 'z' (this will throw an Error in a future version of PHP) in /in/c9ITE(17) : eval()'d code on line 1 Warning: Use of undefined constant u - assumed 'u' (this will throw an Error in a future version of PHP) in /in/c9ITE(17) : eval()'d code on line 1 Warning: Use of undefined constant p - assumed 'p' (this will throw an Error in a future version of PHP) in /in/c9ITE(17) : eval()'d code on line 1 string(15) "*w**a**z**u**p*"
Output for 5.4.11 - 7.1.10
Notice: Use of undefined constant w - assumed 'w' in /in/c9ITE(17) : eval()'d code on line 1 Notice: Use of undefined constant a - assumed 'a' in /in/c9ITE(17) : eval()'d code on line 1 Notice: Use of undefined constant z - assumed 'z' in /in/c9ITE(17) : eval()'d code on line 1 Notice: Use of undefined constant u - assumed 'u' in /in/c9ITE(17) : eval()'d code on line 1 Notice: Use of undefined constant p - assumed 'p' in /in/c9ITE(17) : eval()'d code on line 1 string(15) "*w**a**z**u**p*"
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/c9ITE on line 5
Process exited with code 255.