How could I count the elements of each dimension of an array?

I have this script, but it failed, thanks for any help

<?
$ojpp[0] = "1";
$ojpp[1] = "2";
$ojpp[2] = "3";
$ojpp[3] = "4";
$ojpp[0][1] = "1";
$ojpp[0][2] = "2";
$ojpp[0][3] = "3";
$ojpp[0][0][1] = "1";
$ojpp[0][0][2] = "2";
$test1 = count($ojpp); // first dimension
$test2 = count($ojpp[0]); // second dimension
$test3 = count($ojpp[0][0]); // third dimension
echo $test1;
echo $test2;
echo $test3;
echo "<pre>";
print_r($ojpp);
echo "</pre>";
?>

Reply via email to