3v4l.org

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