3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $in = array(); $foo = 'f1'; $bar = 'b1'; if ( ! isset( $in[$foo][$bar] ) ) { $in[$foo][$bar] = array(); } print_r( $in ); $ob = new stdClass(); if ( ! isset( $ob->$foo->$bar ) ) { $ob->$foo->$bar = array(); } print_r( $ob );
Output for 5.4.0 - 7.1.0
Array ( [f1] => Array ( [b1] => Array ( ) ) ) Warning: Creating default object from empty value in /in/pUkqM on line 13 stdClass Object ( [f1] => stdClass Object ( [b1] => Array ( ) ) )
Output for 5.0.0 - 5.3.29
Array ( [f1] => Array ( [b1] => Array ( ) ) ) Strict Standards: Creating default object from empty value in /in/pUkqM on line 13 stdClass Object ( [f1] => stdClass Object ( [b1] => Array ( ) ) )
Output for 4.3.0 - 4.4.9
Array ( [f1] => Array ( [b1] => Array ( ) ) ) stdClass Object ( [f1] => stdClass Object ( [b1] => Array ( ) ) )