PHP Tutorial detects array length of function sizeof count
The function of detecting array length in PHP has sizeof count below to see a simple instance */
$colorlist = Array ("Apple" = "red", "grass" = "green", "sky" = "Blue", "Night" = "Black", "wall" and "white" );
echo "Array length is:". Count ($colorlist); 5
/*
Count
The count () function calculates the number of cells in an array or the number of properties in an object.
For an array, returns the number of its elements, and returns 1 for other values. Returns 0 if the argument is a variable and the variable is not defined. If mode is set to Count_recursive (or 1), the number of elements in the array in the multidimensional array is recursively computed.
sizeof
Definition and usage
The sizeof () function calculates the number of cells in an array or the number of properties in an object.
Grammar
sizeof (array,mode) parameter description
Array required. Specifies the array or object to count.
mode is optional. Specifies the mode of the function. Possible values:
0-Default. multidimensional arrays (arrays in arrays) are not instrumented.
1-multidimensional array detection.
Note: This parameter was added to PHP 4.2.
Tip Count sizeof
Note: When the variable is not set, or the variable contains an empty array, the function returns 0. You can use the Isset () variable to test whether a variable is set.
http://www.bkjia.com/PHPjc/445398.html www.bkjia.com true http://www.bkjia.com/PHPjc/445398.html techarticle PHP Tutorial detects array length function sizeof count in PHP the function of detecting array length has sizeof count below to see a simple instance */$colorlist = Array (apple=red, grass=green,sky= Blue,nigh ...