3v4l.org

run code in 300+ PHP versions simultaneously
<?php function evalJS($code) { $matches = []; $matches = preg_match_all('#var (.*)( |=|;)#', '\$', $code); foreach($matches[1] as $val) { $code = preg_replace('#'.$val.'#', '\$'.$val, $code); $code = preg_replace('#var \$'.$val.'#', '\$'.$val, $code); $code = preg_replace('#\$'.$val.'\.#', '\$'.$val.'->', $code); } $code = preg_replace('#.#', '::', $code); $code = preg_replace('#(\'|")\+#', '$1.', $code); $code = preg_replace('#\+(\'|")#', '.$1', $code); echo($code); eval($code); } class document { public function print($arg) { echo($arg); } } $js = <<<JS var foo = 'Hello '+'World!'; document.print(foo); JS; evalJS($js);
Output for git.master, git.master_jit
Warning: Trying to access array offset on value of type int in /in/XXlYK on line 6 Warning: foreach() argument must be of type array|object, null given in /in/XXlYK on line 6 Warning: Array to string conversion in /in/XXlYK on line 12 Warning: Array to string conversion in /in/XXlYK on line 12 Warning: Array to string conversion in /in/XXlYK on line 12 Warning: Array to string conversion in /in/XXlYK on line 15 Array Warning: Array to string conversion in /in/XXlYK on line 16 Parse error: syntax error, unexpected end of file, expecting "(" in /in/XXlYK(16) : eval()'d code on line 1
Process exited with code 255.
Output for rfc.property-hooks
Warning: Trying to access array offset on int in /in/XXlYK on line 6 Warning: foreach() argument must be of type array|object, null given in /in/XXlYK on line 6 Warning: Array to string conversion in /in/XXlYK on line 12 Warning: Array to string conversion in /in/XXlYK on line 12 Warning: Array to string conversion in /in/XXlYK on line 12 Warning: Array to string conversion in /in/XXlYK on line 15 Array Warning: Array to string conversion in /in/XXlYK on line 16 Parse error: syntax error, unexpected end of file, expecting "(" in /in/XXlYK(16) : 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:
57.4 ms | 401 KiB | 8 Q