3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arrwithout = array(); $arrwith = array('e' => 42); $str = "test"; $obj = new stdclass(); var_dump($str[$obj]); var_dump($arrwithout[$obj]); var_dump($arrwith[$obj]);
Output for 5.2.0 - 7.1.0
Warning: Illegal offset type in /in/g6luc on line 7 Notice: Object of class stdClass could not be converted to int in /in/g6luc on line 7 string(1) "e" Warning: Illegal offset type in /in/g6luc on line 8 NULL Warning: Illegal offset type in /in/g6luc on line 9 NULL
Output for 5.1.0 - 5.1.6
Notice: Object of class stdClass could not be converted to int in /in/g6luc on line 7 string(1) "e" Warning: Illegal offset type in /in/g6luc on line 8 NULL Warning: Illegal offset type in /in/g6luc on line 9 NULL
Output for 5.0.0 - 5.0.5
string(1) "e" Warning: Illegal offset type in /in/g6luc on line 8 NULL Warning: Illegal offset type in /in/g6luc on line 9 NULL
Output for 4.3.0 - 4.4.9
string(1) "t" Warning: Illegal offset type in /in/g6luc on line 8 NULL Warning: Illegal offset type in /in/g6luc on line 9 NULL