3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = [1,2,3]; $obj = (object)$array; $foo = [ 213 => 'foo', 213.56 => 'foo', 'bar' => 'foo', $array => 'foo', $obj => 'foo' ]; var_dump($foo);
based on ffBSJ
Output for 7.0.0 - 7.3.0rc3
Warning: Illegal offset type in /in/TuivO on line 10 Warning: Illegal offset type in /in/TuivO on line 11 array(2) { [213]=> string(3) "foo" ["bar"]=> string(3) "foo" }
Output for hhvm-3.15.4
Warning: Invalid operand type was used: Invalid type used as key in /in/TuivO on line 10 Warning: Invalid operand type was used: Invalid type used as key in /in/TuivO on line 11 array(2) { [213]=> string(3) "foo" ["bar"]=> string(3) "foo" }
Output for 5.6.0 - 5.6.30
Warning: Illegal offset type in /in/TuivO on line 10 Warning: Illegal offset type in /in/TuivO on line 12 array(2) { [213]=> string(3) "foo" ["bar"]=> string(3) "foo" }