RE: [PHP] Count columns in array

2001-02-15 Thread James Atkinson
> 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]) . ""; } Thats assumeing that y is an array... - James -- PHP Gener

Re: [PHP] Count columns in array

2001-02-15 Thread Mukul Sabharwal
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 print

Re: [PHP] Count columns in array

2001-02-15 Thread Philip Olson
Try this : $a: ' . sizeof($a);// 2 print ' $a[0] : ' . sizeof($a[0]); // 3 print ' $a[1] : ' . sizeof($a[1]); // 1 ?> Regards, Philip Olson http://www.cornado.com/ On Thu, 15 Feb 2001, Fabian Fabela wrote: > Hello, > > I have the array $array[x][y]; > > if I want to know