shadowline
Merging Arrays << Counting Arrays >> Accessing Arrays
Counting the number of elements in an array uses a command called count.

First we will start with our original pantry array :
<?php
$pantry = array(
   1 => "apples",
   2 => "oranges",
   3 => "bananas"
   );
?>


Now to count how many elements are in this array...
<?php
$total_elements = count($pantry);
echo "There are $total_elements elements in the array.";
?>

This will produce the result :
There are 3 elements in the array.
Merging Arrays << Counting Arrays >> Accessing Arrays
shadow

Advertise in the banner along the top, Click here!

Valid XHTML 1.0 Transitional Valid CSS! Text Link Ads
shadow
shadow