Hello,
I have the array $array[x][y];
if I want to know the x I use count($array);
Now, How can I count the y??
Thank you.
Fabian Fabela
[EMAIL PROTECTED]
www.vacagorda.com
Hello,
I have the array $array[x][y];
if I want to know the x I use count($array);
Now, How can I count the y??
for($x = 0; $x = count($array); $x++) {
echo "Number of elements at $x: " . count($array[$x]) . "br";
}
Thats assumeing that y is an array...
- James
--
PHP General
Hi,
Well it depends, on which elements /2nd/ dimension you
wanna see!
here's some code:
$myarr[0][0] = "sdkjsjks";
$myarr[1][0] = "dsjkdkjsd";
$myarr[1][1] = "hsjdsh";
$myarr[1][2] = "dsjkdsjkdkjsdkjs";
echo sizeof($myarr); // would print 2, element 0 and
1.
echo sizeof($myarr[0]); would
Try this :
?php
$a[0][0] = 'a';
$a[0][1] = 'b';
$a[0][2] = 'c';
$a[1][0] = 'aa';
print 'br $a: ' . sizeof($a);// 2
print 'br $a[0] : ' . sizeof($a[0]); // 3
print 'br $a[1] : ' . sizeof($a[1]); // 1
?
Regards,
Philip Olson
http://www.cornado.com/
On Thu,
4 matches
Mail list logo