- In PHP this unbuilt function is used to count the current elements in the array.
- If it has been set to an empty array, whether the function might return 0 for the variable and the variable that is not set the function returns 0.
- Generally, this function takes one parameter, the array for which the elements need to be counted.
- The function an take a parameter mode which tells the function to count the element in recursive or normal mode but in addition.
- In Count () syntax $array is mandatory and in which elements are needed to be counted.
- In Count () mode is optional which is used to set the mode of function and their parameter can take two possible values, either 0 or 1. 1 generally indicates to count of the values of the array recursively.
- In an array, the functions return the number of elements.
Syntax
Sample Code
Output