How To Count Array Values Php Counting Arrays Holds Variables Script

RegisterLogin
How To Count Array Values Php Counting Arrays Holds Variables Script
Post Description: How To Count Array Values Php Counting Arrays Holds Variables Script
Tags: How, To, Count, Array, Values, Php, Counting, Arrays, Holds, Variables, Script
This Post Was Posted On Feb 29, 2008 By web hosting #1292
how do i count the values of how many an array hold?

example:

$items = array("one", "two", "three", "four", "five", "six", "seven");
Julius
#1721 1
thanks this was helpful. i was storing some values in a comma separated list and converting it to an array with explode and didn't notice the comma at the end of the list nothing after it was being counted as an element and causing problems until i counted the number of value s in the array.
Feb 14, 2008 Reply Report abuse
lucas
#1720 2
that's very easy, just use the count() function in php..



you can do this:



PHP CODE:
<?

$items = array("one", "two", "three", "four", "five", "six", "seven");

echo count($items);

?>




OUTPUT
7
Feb 11, 2008 Reply Report abuse
©2011 Webune Forums - Mon Dec 19, 2011 6:23 pm
Powered by: Webune Forums V3