3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php error_reporting(E_ALL); $b = null; var_dump($b['foo1']); $b = ""; var_dump($b['foo2']); $b = 345678; var_dump($b['foo3']);
based on 1UoqI
Output for 5.4.0 - 5.6.28, 7.0.0 - 7.1.0
NULL Warning: Illegal string offset 'foo2' in /in/Jc7tr on line 7 Notice: Uninitialized string offset: 0 in /in/Jc7tr on line 7 string(0) "" NULL
Output for hhvm-3.10.0 - 3.12.0
NULL string(0) "" NULL
Output for 5.2.10 - 5.3.29
NULL Notice: Uninitialized string offset: 0 in /in/Jc7tr on line 7 string(0) "" NULL
Output for 4.3.0 - 5.2.9
NULL Notice: Uninitialized string offset: 0 in /in/Jc7tr on line 7 string(0) "" NULL