Inspiration: https://stackoverflow.com/q/11827451/282601
1 2 3 4 5 6 7 | <?php $a = ['a1', 'a2', 'a3']; $b = ['b1', 'b2', 'b3', 'b4', 'b5']; $combo = array_filter(array_merge(...array_map(null, $a, $b))); var_dump($combo); |
array(8) { [0]=> string(2) "a1" [1]=> string(2) "b1" [2]=> string(2) "a2" [3]=> string(2) "b2" [4]=> string(2) "a3" [5]=> string(2) "b3" [7]=> string(2) "b4" [9]=> string(2) "b5" }