Here is the array
$array = [
a=>["name"= "name1", "id"="1"..],
b=>["name"= "name2", "id"="2"..],
c=>["name"= "name3", "id"="3"..],
d=>["name"= "name4", "id"="4"..],
e=>["name"= "name5", "id"="5"..],
f=>["name"= "name6", "id"="6"..],......);
What i want to achieve is foreach loop to echo items like this

here is what i did, but no luck
$len = count($moduleTypes);
$firsthalf = array_slice($moduleTypes, 0, $len / 2);
$secondhalf = array_slice($moduleTypes, $len / 2);
Break array and echo each one individually, Foreach loop has to continue, but on second iteration, it need to loop two times [B,C] and next iteration one time [D], and so on.. check image for perspective