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 the x I use count($array);
> 
> Now, How can I count the y??
> 
> Thank you.
> 
> Fabian Fabela
> [EMAIL PROTECTED]
> www.vacagorda.com
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




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 1, 0 of 0.
echo sizeof($myarr[1]); would print 3, 3 of 1.

Hope that helps. It goes on into as many dimensions!

=
To find out more about me : http://www.geocities.com/mimodit
My bookmarks are available @ http://mukul.free.fr

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




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 General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Count columns in array

2001-02-15 Thread Fabian Fabela

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