3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $inputArray = ['foo', 'bar', 'foz', 'baz', 'fozboo']; $endResult = []; foreach (array_chunk($inputArray, 2) as $pair) { $endResult[] = $pair[0] . $pair[1]; } var_dump($endResult);
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.2.6
Notice: Undefined offset: 1 in /in/YlCgG on line 9 array(3) { [0]=> string(6) "foobar" [1]=> string(6) "fozbaz" [2]=> string(6) "fozboo" }
Output for hhvm-3.15.4
Notice: Undefined index: 1 in /in/YlCgG on line 9 array(3) { [0]=> string(6) "foobar" [1]=> string(6) "fozbaz" [2]=> string(6) "fozboo" }