It seems to me that PHP does not allow the use of count() to determine if an element is an array or an object. They have special functions for this ( is_array() , is_object() ), and it may be tempting to use count() naively and check the false condition to define an array or object. Instead, PHP does non-objects, non-arrays returns 1 (which is true), so this method cannot be naively used that way (since 0 is a valid, false result for an empty array / object).
This may be the reason for choosing the value returned by the function in the described situation.
Gabriel Dec 28 '13 at 20:19 2013-12-28 20:19
source share