how do i count the values of how many an array hold?
example:
$items = array("one", "two", "three", "four", "five", "six", "seven");
Comments and replies About how to count array values php counting arrays holds variables script
lucas:
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
Julius:
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.