I have 2 arrays :
$arr1 = array('1', '2', '3', '4', '5', '6', '7');
$arr2 = array('a', 'b', 'c', 'd', 'e');
I want to loop $arr2 into $arr1 but if the length of $arr1 is less than the algorithm requires, only use as many elements of $arr2 as necessary.
I want to achieve this result:
$arr2 = array('1', '2', '3', 'a', '4', '5', '6', 'b', '7');
I have already tried :
$count = ceil(count($arr1) / 3) - 1;
for ($i = 0; $i < $count; $i++) {
array_splice($arr1, 3, 0, $arr2);
}