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);

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for Typed properties v2
string(9) "lambda_1" string(2) "12" string(8) "lambda_1" string(2) "12"
Output for Array change keys
string(9) "lambda_1" string(2) "12" string(8) "lambda_1" string(2) "12"
Output for Lexical anon
string(9) "lambda_1" string(2) "12" string(8) "lambda_1" string(2) "12"

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page