3v4l.org

run code in 300+ PHP versions simultaneously
<?php (function () { foreach ([42, true] as $v) { ${$v} = $v; } unset($v); var_dump(get_defined_vars()); var_dump(compact(42, true)); var_dump(compact((string)42, (string)true)); })();
Output for git.master, git.master_jit
array(2) { ["42"]=> int(42) ["1"]=> bool(true) } Warning: compact(): Argument #1 must be string or array of strings, int given in /in/WGVGr on line 9 Warning: compact(): Argument #2 must be string or array of strings, bool given in /in/WGVGr on line 9 array(0) { } array(2) { ["42"]=> int(42) ["1"]=> bool(true) }
Output for rfc.property-hooks
array(2) { ["42"]=> int(42) ["1"]=> bool(true) } Warning: compact(): Argument #1 must be string or array of strings, int given in /in/WGVGr on line 9 Warning: compact(): Argument #2 must be string or array of strings, true given in /in/WGVGr on line 9 array(0) { } array(2) { ["42"]=> int(42) ["1"]=> bool(true) }

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:
135.1 ms | 407 KiB | 5 Q