3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function create_function2($args, $content) { static $counter = 0; $funcname = "lambda_" . (++$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 7.2.0 - 7.3.1
Deprecated: Function create_function() is deprecated in /in/A2Lvd on line 10 string(9) "lambda_1" string(2) "12" string(8) "lambda_1" string(2) "12"
Output for 4.3.0 - 7.1.25
string(9) "lambda_1" string(2) "12" string(8) "lambda_1" string(2) "12"