3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $foo = 'foo'; $bar->$foo = array(); $bar->$foo[0] = 42; var_dump($bar);
based on pImS3
Output for 7.0.0 - 7.2.0
Warning: Creating default object from empty value in /in/ksEpB on line 4 object(stdClass)#1 (1) { ["foo"]=> array(1) { [0]=> int(42) } }
Output for 5.4.10 - 5.6.28
Warning: Creating default object from empty value in /in/ksEpB on line 4 object(stdClass)#1 (2) { ["foo"]=> array(0) { } ["f"]=> int(42) }
Output for 5.3.20 - 5.3.29
Strict Standards: Creating default object from empty value in /in/ksEpB on line 4 object(stdClass)#1 (2) { ["foo"]=> array(0) { } ["f"]=> int(42) }