3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $data = 'here\'s some data'; var_dump($data['string']); var_dump($data['string'][0]); var_dump($data[0][0]); var_dump($data[0][0][0]); var_dump($data[10][222][555]); var_dump($data[1]); var_dump($data[1][0]);
Output for 5.4.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: Illegal string offset 'string' in /in/6hNaV on line 5 string(1) "h" Warning: Illegal string offset 'string' in /in/6hNaV on line 6 string(1) "h" string(1) "h" string(1) "h" Notice: Uninitialized string offset: 222 in /in/6hNaV on line 9 Notice: Uninitialized string offset: 555 in /in/6hNaV on line 9 string(0) "" string(1) "e" string(1) "e"
Output for hhvm-3.10.0 - 3.12.0
string(1) "h" string(1) "h" string(1) "h" string(1) "h" string(0) "" string(1) "e" string(1) "e"
Output for 5.0.0 - 5.3.29
string(1) "h" Fatal error: Cannot use string offset as an array in /in/6hNaV on line 6
Process exited with code 255.
Output for 4.3.0 - 4.4.9
string(1) "h" NULL NULL NULL NULL string(1) "e" NULL