Return Length of Array, (js: array.length, how in php?)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Return Length of Array, (js: array.length, how in php?)

Post by Jonah Bron »

Hi,

How do I access the amount of fields in an array? In Javascript, it is arrayname.length. What is it in PHP?

Thanks
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Arrays are not objects in PHP:

Code: Select all

$length = count($myarray);
(#10850)
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Post by Jonah Bron »

Ah. Thanks. Thats it :D
Post Reply