- array_shift: documentation ( source)
<?php
$lines = array
(
['a','b','c','d'],
['e','f','g'],
['h','i']
);
$continue = true;
while($continue)
{
$continue = false;
foreach($lines as $key => $line) {
if(!empty($line)) {
echo array_shift($line);
$lines[$key] = $line;
$continue = true;
}
}
}