Source Code:
(back to article)
<?php $colors = array("red", "green", "blue"); $fruits = array("apple", "banana", "cherry"); $merged = array_reduce(array($colors, $fruits), function($carry, $item) { return array_merge($carry, $item); }, array()); print_r($merged); // Array ( [0] => red [1] => green [2] => blue [3] => apple [4] => banana [5] => cherry ) ?>
Result:
Report an issue