3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $labels = array('Element1', 'Element2', 'Element3', 'Element4', 'Element5', 'Element6'); # Put them into pairs $pairs_array = array_chunk($labels, 2); # Use array_map with custom function function joinTwoStrings($one_pair) { return $one_pair[0] . ', ' . $one_pair[1]; } $pairs_array = array_map('joinTwoStrings', $pairs_array); echo implode(',' . PHP_EOL, $pairs_array);
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Element1, Element2, Element3, Element4, Element5, Element6
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Element1, Element2,PHP_EOLElement3, Element4,PHP_EOLElement5, Element6