3v4l.org

run code in 300+ PHP versions simultaneously
<?php function create_function2($args, $content) { static $counter = 0; $funcname = '_internal_' . (++$counter); eval("function $funcname ({$args}) { {$content}; }'); return $funcname; } $func1 = create_function('$a,$b', 'return $a.$b;'); $func2 = create_function2('$a,$b', 'return $a.$b;'); $rs1 = $func1(1, 2); $rs2 = $func2(1, 2); var_dump($func1, $rs1); var_dump($func2, $rs2);
Output for 5.4.0 - 5.4.21
Parse error: syntax error, unexpected end of file in /in/PFevZ on line 17
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected $end in /in/PFevZ on line 17
Process exited with code 255.

preferences:
182.46 ms | 1394 KiB | 57 Q