> -----Original Message----- > From: Tsvetan Nikolov [mailto:live.webscore@xxxxxxxxx] > Sent: Wednesday, November 27, 2013 10:15 AM > To: Daevid Vincent > Cc: PHP-General > Subject: Re: echo count(false); == 1 ?! > > Just think about it. When was the last time you counted something and the > result was false? It makes no sense. Logically counting should return > negative, 0 or positive value. Well in my case I have a method that populates a property. The property starts out as null (since it was never loaded). If there is an error, the method returns false, otherwise it fills the array. We could argue about flow/logic/etc. and how to "fix" my code. But logically, given how null/false/0 are usually treated, almost interchangeably, such as $foo = false; $foo = 0; $foo = null; If (!foo) .... All do the same thing It would stand to reason that count() would return 0 for anything that isn't an array, as there are ZERO elements in the "array". -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php