Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

integer count(variable array)


The count function returns the number of elements in an array. If the variable has never
been set, count returns zero. If the variable is not an array, count returns 1. Despite this
added functionality, you should use the isset and is_array functions to determine the
nature of a variable.


<?
$colors = array("red", "green", "blue");
print(count($colors));
?>

Free download pdf