count the elements of each dimension of the array

From: Date: Sat, 13 Dec 2003 04:22:33 +0000
Subject: count the elements of each dimension of the array
Groups: php.general 
Request: Send a blank email to php-general+get-172629@lists.php.net to get a copy of this message
I have this script: <? $ojpp[] = "1"; $ojpp[] = "2"; $ojpp[] = "3"; $ojpp[] = "4"; $ojpp[][] = "1"; $ojpp[][] = "2"; $ojpp[][] = "3"; $ojpp[][][] = "1"; $ojpp[][][] = "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; ?> I want to count the elements of each dimension, but the script give me an error, thanks in advanced for any help.

« previous php.general (#172629) next »