Snubby Posted October 18, 2006 Share Posted October 18, 2006 How can I check the length of an array? In ActionScript I'd go, my_array.length; but that doesn't work in PHP. Help? Link to comment Share on other sites More sharing options...
reportingsjr Posted October 18, 2006 Share Posted October 18, 2006 echo sizeof($array);, just do a quick search on php.net! Link to comment Share on other sites More sharing options...
justsomeguy Posted October 18, 2006 Share Posted October 18, 2006 It would be very slightly more efficient to use count instead of sizeof, since sizeof is an alias of count. Link to comment Share on other sites More sharing options...
Snubby Posted October 18, 2006 Author Share Posted October 18, 2006 It would be very slightly more efficient to use count instead of sizeof, since sizeof is an alias of count.How do I use count? Link to comment Share on other sites More sharing options...
www.mihalism.com Posted October 19, 2006 Share Posted October 19, 2006 How do I use count? http://us2.php.net/manual/en/function.count.php Link to comment Share on other sites More sharing options...
Snubby Posted October 19, 2006 Author Share Posted October 19, 2006 http://us2.php.net/manual/en/function.count.phpThanks a lot! Link to comment Share on other sites More sharing options...
aspnetguy Posted October 19, 2006 Share Posted October 19, 2006 It would be very slightly more efficient to use count instead of sizeof, since sizeof is an alias of count.did they just make sizeof() to be an alias of count() because programmers are used to using sizeof() in C? Or is there a more indepth reason? Link to comment Share on other sites More sharing options...
justsomeguy Posted October 19, 2006 Share Posted October 19, 2006 That might be one reason, or maybe because it was supported in an earlier version of PHP, and then they changed it to count for whatever reason. Link to comment Share on other sites More sharing options...
aspnetguy Posted October 19, 2006 Share Posted October 19, 2006 That might be one reason, or maybe because it was supported in an earlier version of PHP, and then they changed it to count for whatever reason.Thanks,It seems odd that they would stop using sizeof() in favor of count() when PHP is so much like C. Probably got requests for sizeof() or questions about so they desided to alias it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now