3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php error_reporting(-1); // show all possible errors $obj = new stdclass(); $arr = array(); var_dump($arr['foo']); // Notice: Undefined index var_dump($arr[$obj]); // Warning: Illegal offset type $arr = null; var_dump($arr['foo']); // No error var_dump($arr[$obj]); // No error $arr = null; $arr['i'] = $arr['i'] + 1; // No error $arr = null; $arr['i']++; // Notice: Undefined index
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined index: foo in /in/69tSS on line 8 NULL Warning: Illegal offset type in /in/69tSS on line 9 NULL NULL NULL Notice: Undefined index: i in /in/69tSS on line 19
Output for hhvm-3.12.0
Notice: Undefined index: foo in /in/69tSS on line 8 NULL Warning: Invalid operand type was used: Invalid type used as key in /in/69tSS on line 9 Fatal error: Uncaught Error: Object of class stdClass could not be converted to string in /in/69tSS:9 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.10.0
Notice: Undefined index: foo in /in/69tSS on line 8 NULL Warning: Invalid operand type was used: Invalid type used as key in /in/69tSS on line 9 Catchable fatal error: Object of class stdClass could not be converted to string in /in/69tSS on line 9
Process exited with code 255.
Output for 4.3.0 - 5.0.5, 5.1.1 - 5.2.17
Notice: Undefined index: foo in /in/69tSS on line 8 NULL Warning: Illegal offset type in /in/69tSS on line 9 NULL NULL NULL Notice: Undefined index: i in /in/69tSS on line 19
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/69tSS on line 19
Process exited with code 255.