3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
string(9) "lambda_1" string(2) "12" string(11) "_internal_1" string(2) "12"
Output for hhvm-3.10.0

Process exited with code 153.