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 git.master, git.master_jit, rfc.property-hooks
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.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
47.09 ms | 401 KiB | 8 Q