R3m/framework Function reference array.count

{array.count(Countable | Array $array, $mode=COUNT_NORMAL)}

Counts all elements in an array, or something in an object.

For objects, if you have SPL installed, you can hook into {array.count()} by implementing interface Countable.
The interface has exactly one method, Countable::count(), which returns the return value for the {array.count()} function.

Please see the Array section of the manual for a detailed explanation of how arrays are implemented and used in PHP.

Returns the number of elements in the array as an int.
When the parameter is neither an array, nor an object with implemented Countable interface, 1 will be returned.
There is one exception, if array is null, 0 will be returned.

More information:


Last modified: 2021-06-07

© 2021 universeorange.com