3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo(&$a, $b) { $a = 'modified'; $b = 'modified'; } class C { function foo(&$a, $b) { $a = 'modified'; $b = 'modified'; } } class S { static function foo(&$a, $b) { $a = 'modified'; $b = 'modified'; } } $vv["'foo'"] = 'foo'; $vv["['S', 'foo']"] = ['S', 'foo']; $vv["[new C, 'foo']"] = [new C, 'foo']; $vv["function(..){..}"] = function(&$a, $b) { $a = 'modified'; $b = 'modified'; }; $vv["'S::foo'"] = 'S::foo'; foreach ($vv as $label => $v) { print $label; print is_callable($v) ? 'is callable' : 'is not callable'; print "\n"; $a = 'orig'; $b = 'orig'; call_user_func_array($v, array(&$a, &$b)); assert($a === 'modified'); assert($b === 'orig'); $a = 'orig'; $b = 'orig'; $v($a, $b); assert($a === 'modified'); assert($b === 'orig'); }
Output for git.master, git.master_jit, rfc.property-hooks
'foo'is callable ['S', 'foo']is callable [new C, 'foo']is callable function(..){..}is callable 'S::foo'is callable

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

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


preferences:
49.09 ms | 405 KiB | 9 Q