I don't know if there is a simple way. Of course, I'm not sure I'm even understanding you correctly.
Are you looking for the table to vary with the size of the returned array? Seems likely, I'd say... what am I thinking?
Do you need the array to start from a [0] index, even though the original array might start at, say, [25] ?
I used this once:
function compact_array($array_size) {
if ($the_array) {
for ($y=$array_size; $y>0; $y--) {
$x=($y-1);
if (((empty($the_array[$x]) || (!($the_array[$x])))) && ($the_array[$y])){
$the_array[$x]=$the_array[$y];
unset($the_array[$y]);
}
}
}
}
Replace $the_array with the name of your array, and feed the function the desired size to check (in your case, 50, I guess). This is working on a $_SESSION array in a cart script I've completed --- there could be scope issues on other arrays, I've not tested....