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 \0{$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" Warning: Unexpected character in input: ' in /in/El2H6(6) : eval()'d code on line 1 string(26) "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/El2H6 on line 4 Warning: Unexpected character in input: ' in /in/El2H6(6) : eval()'d code on line 1 string(18) "lambda_PHP_INT_MAX" int(3)