Counts all elements in an array, or something in an object.
For objects, if you have SPL installed, you can hook into count() by implementing interface Countable. The interface has exactly one method, Countable::count(), which returns the return value for the count() function.
Please see the Array section of the manual for a detailed explanation of how arrays are implemented and used in PHP.