3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array('a' => 'aa'); $x = new ArrayObject; $x[null] = array(); $x[null]['bar'] = 'foo'; ### this causes it # ---------------------------------------- function f($k) { $f = array('f' => 'ff'); return $f[$k]; } echo "ArrayObject dump:\n"; var_dump($x); echo "Non-existing array elements (current scope, function scope)\n"; var_dump($a['b'], f('b')); echo "Define a new variable: \$s='hohohoooo'\n"; $s = 'hohohoooo'; var_dump($a['b'], f('b')); echo "Define a new variable: \$n=1\n"; $n = 1; var_dump($a['b'], f('b'));
Output for git.master, git.master_jit, rfc.property-hooks
ArrayObject dump: object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(2) { [0]=> array(0) { } [""]=> array(1) { ["bar"]=> string(3) "foo" } } } Non-existing array elements (current scope, function scope) Warning: Undefined array key "b" in /in/p0fnK on line 20 Warning: Undefined array key "b" in /in/p0fnK on line 13 NULL NULL Define a new variable: $s='hohohoooo' Warning: Undefined array key "b" in /in/p0fnK on line 24 Warning: Undefined array key "b" in /in/p0fnK on line 13 NULL NULL Define a new variable: $n=1 Warning: Undefined array key "b" in /in/p0fnK on line 28 Warning: Undefined array key "b" in /in/p0fnK on line 13 NULL NULL

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:
34.33 ms | 402 KiB | 8 Q