3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = array(1 => '5ive', 'jim' => 'bob', 4 => 5); var_dump($array); echo array_slice($array, 0, 1); var_dump($array);
Output for 5.4.0 - 7.1.7
array(3) { [1]=> string(4) "5ive" ["jim"]=> string(3) "bob" [4]=> int(5) } Notice: Array to string conversion in /in/JI1JV on line 6 Arrayarray(3) { [1]=> string(4) "5ive" ["jim"]=> string(3) "bob" [4]=> int(5) }
Output for 4.3.0 - 5.3.29
array(3) { [1]=> string(4) "5ive" ["jim"]=> string(3) "bob" [4]=> int(5) } Arrayarray(3) { [1]=> string(4) "5ive" ["jim"]=> string(3) "bob" [4]=> int(5) }