3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function create_function2($args, $content) { static $counter = PHP_MAX_INT; $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 7.2.0 - 7.2.12
Deprecated: Function create_function() is deprecated in /in/8jYXW on line 11 Deprecated: Function create_function() is deprecated in /in/8jYXW on line 12 string(9) "lambda_1" string(18) "006c616d6264615f32" Warning: Use of undefined constant PHP_MAX_INT - assumed 'PHP_MAX_INT' (this will throw an Error in a future version of PHP) in /in/8jYXW on line 4 string(19) "_lambda_PHP_MAX_INT" int(3)
Output for 4.3.0 - 5.6.38, hhvm-3.10.1 - 3.21.3, 7.0.0 - 7.1.24
string(9) "lambda_1" string(18) "006c616d6264615f32" Notice: Use of undefined constant PHP_MAX_INT - assumed 'PHP_MAX_INT' in /in/8jYXW on line 4 string(19) "_lambda_PHP_MAX_INT" int(3)
Output for hhvm-3.22.0
string(9) "lambda_1" string(18) "006c616d6264615f32" Notice: Use of undefined constant PHP_MAX_INT - assumed 'PHP_MAX_INT' in /in/8jYXW on line -1 string(19) "_lambda_PHP_MAX_INT" int(3)