Hello guys please help I have array contains three arrays , each array contains a different amount of chars how ever the first array always have the greater amount of chars then the second and so on . Notice that two Consecutive arrays may have the same amount of chars check this example
array //called lines
(
['a','b','c','d'],
['e','f','g'],
['h','i']
);
Am trying to iterate the main array and each time print the first letter of each array and then shift it out of the array so first time I will print 'a' from the first array shift it from the array and then move to second array and print 'e' and shift it from the array , move to the third and print 'h' the shift it then go back and do the same till all of them are empty so how can I do that here is what the output should look like "aehbficgd" sorry if the question is too long thanks
while(!empty($lines))
{
$counter = 0;
echo $lines[$counter][0];
array_shift($lines[$counter]);
$counter++;
if($counter == count($lines))
{
$counter = 0;
}
}