3v4l.org

run code in 300+ PHP versions simultaneously
<?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'));
Output for 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Fatal error: Uncaught Error: Undefined constant "w" in /in/c9ITE(17) : eval()'d code:1 Stack trace: #0 /in/c9ITE(17): eval() #1 [internal function]: x->{closure}(Array) #2 /in/c9ITE(16): preg_replace_callback('~.~', Object(Closure), 'wazup') #3 /in/c9ITE(29): x->p('wazup') #4 {main} thrown in /in/c9ITE(17) : eval()'d code on line 1
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
Fatal error: Uncaught Error: Undefined constant "w" in /in/c9ITE(17) : eval()'d code:1 Stack trace: #0 /in/c9ITE(17): eval() #1 [internal function]: x->{closure}(Array) #2 /in/c9ITE(18): preg_replace_callback('~.~', Object(Closure), 'wazup') #3 /in/c9ITE(29): x->p('wazup') #4 {main} thrown in /in/c9ITE(17) : eval()'d code on line 1
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
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.5.0 - 5.5.38, 5.6.0 - 5.6.38, 7.0.0 - 7.0.33, 7.1.0 - 7.1.25
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*"

preferences:
228.71 ms | 403 KiB | 295 Q