php tutorials to detect array length function sizeof count
The function of the length of the array in php detection Sizeof count below to see a simple example * /
$ colorlist = array ("apple" => "red", "grass" => "green", "sky" => "blue", "night" => "black", "wall" => "white") ;
echo "The array length is:" .count ($ colorlist); // 5
/ *
count
The count () function evaluates the number of cells in the array or the number of attributes in the object.
For arrays, returns the number of its elements, 1 for all other values. If the argument is a variable and the variable is not defined, 0 is returned. If mode is set to count_recursive (or 1), the number of elements in the array in the multidimensional array is calculated recursively.
sizeof
Definition and usage
The sizeof () function evaluates the number of cells in the array or the number of attributes in the object.
grammar
sizeof (array, mode) Parameter Description
array required. Specifies the array or object to count.
mode optional. Specifies the mode of the function. Possible values:
0 - the default. Do not detect multi-dimensional arrays (arrays in arrays).
1 - Detect multidimensional arrays.
Note: This parameter is added in php 4.2.
Prompt count sizeof
Note: This function returns 0 when the variable is not set, or if the variable contains an empty array. You can use the isset () variable to test whether the variable is set.