3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $meh = null; $foo = (bool) array_shift($meh); var_dump($foo); $bar = (array) null; var_dump((bool) $bar[0]->something);
Output for 5.3.0 - 5.6.26, 7.0.0 - 7.1.0
Warning: array_shift() expects parameter 1 to be array, null given in /in/InYQq on line 4 bool(false) Notice: Undefined offset: 0 in /in/InYQq on line 7 Notice: Trying to get property of non-object in /in/InYQq on line 7 bool(false)
Output for hhvm-3.10.0 - 3.13.2
Warning: array_shift() expects parameter 1 to be an array or mutable collection in /in/InYQq on line 4 bool(false) Notice: Undefined index: 0 in /in/InYQq on line 7 Notice: Cannot access property on non-object in /in/InYQq on line 7 bool(false)
Output for 5.0.0 - 5.2.17
Warning: array_shift(): The argument should be an array in /in/InYQq on line 4 bool(false) Notice: Undefined offset: 0 in /in/InYQq on line 7 Notice: Trying to get property of non-object in /in/InYQq on line 7 bool(false)
Output for 4.3.2 - 4.4.9
Warning: array_shift(): The argument should be an array in /in/InYQq on line 4 bool(false) Notice: Undefined offset: 0 in /in/InYQq on line 7 bool(false)
Output for 4.3.0 - 4.3.1
Warning: array_shift() [http://www.php.net/function.array-shift]: The argument should be an array in /in/InYQq on line 4 bool(false) Notice: Undefined offset: 0 in /in/InYQq on line 7 bool(false)