Below i have a loop that will create two arrays of odd and evens numbers.
But what i really need is one loop, that goes through the array
and gets first 4 odd items and show them and then show next 4 even items, then next 4 odd item and so on.
<?php
$array = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14);
$odd = array();
$even = array();
foreach($array AS $item){
if ($item & 1) {
$odd[] = $item ;
}else{
$even[] = $item ;
}
}
?>
i thought having two seprate arrays might make things simpler, but im unsure.