3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $expected_array_got_string = 'somestring'; var_dump(empty($expected_array_got_string['some_key'])); var_dump(empty($expected_array_got_string[0])); var_dump(empty($expected_array_got_string['0'])); var_dump(empty($expected_array_got_string[0.5])); var_dump(empty($expected_array_got_string['0.5'])); var_dump(empty($expected_array_got_string['0 Mostel'])); echo (array)$expected_array_got_string['some_key']; echo $expected_array_got_string[0]; echo $expected_array_got_string['0']; echo $expected_array_got_string[0.6]; echo $expected_array_got_string['0.5']; echo $expected_array_got_string['0 Mostel'];
Output for 5.4.5 - 5.6.28, 7.0.0 - 7.1.0
bool(true) bool(false) bool(false) bool(false) bool(true) bool(true) Warning: Illegal string offset 'some_key' in /in/7GBt1 on line 10 Notice: Array to string conversion in /in/7GBt1 on line 10 Arrayss Notice: String offset cast occurred in /in/7GBt1 on line 13 s Warning: Illegal string offset '0.5' in /in/7GBt1 on line 14 s Notice: A non well formed numeric value encountered in /in/7GBt1 on line 15 s
Output for hhvm-3.10.0 - 3.12.0
bool(true) bool(false) bool(false) bool(false) bool(true) bool(true) Notice: Array to string conversion in /in/7GBt1 on line 10 Arrayss Notice: String offset cast occurred in /in/7GBt1 on line 13 sss
Output for 5.4.0 - 5.4.4
bool(true) bool(false) bool(false) bool(false) bool(true) bool(true) Warning: Illegal string offset 'some_key' in /in/7GBt1 on line 10 Notice: Array to string conversion in /in/7GBt1 on line 10 Arrayss Notice: String offset cast occured in /in/7GBt1 on line 13 s Warning: Illegal string offset '0.5' in /in/7GBt1 on line 14 s Notice: A non well formed numeric value encountered in /in/7GBt1 on line 15 s
Output for 4.3.0 - 4.4.9, 5.0.3 - 5.3.29
bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) Arraysssss
Output for 5.0.0 - 5.0.2
bool(true) bool(false) bool(true) bool(true) bool(true) bool(true) Arraysssss