3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $data=array('data'=>array('something')); echo "Good\n"; var_dump(isset($data['data'][0])); var_dump($data['data'][0]); echo "Bad\n"; var_dump(isset($data['data'][0]['data'])); var_dump($data['data'][0]['data']); echo "Ugly\n"; var_dump(isset($data['data'][0]['data'][0])); var_dump($data['data'][0]['data'][0]);
Output for 7.0.0 - 7.1.0
Good bool(true) string(9) "something" Bad bool(false) Warning: Illegal string offset 'data' in /in/qoufW on line 12 string(1) "s" Ugly bool(false) Warning: Illegal string offset 'data' in /in/qoufW on line 17 string(1) "s"
Output for 5.4.0 - 5.6.28
Good bool(true) string(9) "something" Bad bool(false) Warning: Illegal string offset 'data' in /in/qoufW on line 12 string(1) "s" Ugly bool(true) Warning: Illegal string offset 'data' in /in/qoufW on line 17 string(1) "s"
Output for 5.0.3 - 5.3.29
Good bool(true) string(9) "something" Bad bool(true) string(1) "s" Ugly bool(false) Fatal error: Cannot use string offset as an array in /in/qoufW on line 17
Process exited with code 255.
Output for 5.0.0 - 5.0.2
Good bool(true) string(9) "something" Bad bool(false) string(1) "s" Ugly bool(false) Fatal error: Cannot use string offset as an array in /in/qoufW on line 17
Process exited with code 255.
Output for 4.3.0 - 4.4.9
Good bool(true) string(9) "something" Bad bool(true) string(1) "s" Ugly bool(false) NULL