function print_array($arr2d)
{
echo '<table border="0" cellspacing="3">';
$rows = count($arr2d);
for ($i = 0; $i < $rows; $i++)
{
echo "<tr align='right'>";
$cols = count($arr2d[$i]);
for ($j = 0; $j < $cols; $j++)
echo "<td>" . $arr2d[$i][$j] . "</td>";
echo "</tr>";
}
echo "</table>";
}
$a = array(array(1, 8, 5, 9),
array(6, 7, 1, 5),
);
echo "total rows = " . count($a) . "<br />";
for ($i = 0; $i < count($a); $i++)
echo "row = " . $i . " cols = " . count($a[$i]) . "<br />";
print_array($a);
/*
run:
total rows = 2
row = 0 cols = 4
row = 1 cols = 4
1 8 5 9
6 7 1 5
*/