3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function create_function2($args, $content) { static $counter = PHP_INT_MAX; $funcname = '_lambda_' . (--$counter); eval("function {$funcname} ({$args}) { {$content}; }"); return $funcname; } var_dump( create_function('$a,$b', 'return $a+$b;'), bin2hex(create_function('$a,$b', 'return $a+$b;')) ); $f = create_function2('$a,$b', 'return $a+$b;'); var_dump($f, $f(1,2));
Output for 4.4.0 - 4.4.9, 5.0.5 - 7.1.0
string(9) "lambda_1" string(18) "006c616d6264615f32" string(27) "_lambda_9223372036854775806" int(3)
Output for 4.3.0 - 4.3.11, 5.0.0 - 5.0.4
string(9) "lambda_1" string(18) "006c616d6264615f32" Notice: Use of undefined constant PHP_INT_MAX - assumed 'PHP_INT_MAX' in /in/Osb9T on line 4 string(19) "_lambda_PHP_INT_MAX" int(3)