You're only counting ONE thing in this case a single boolean value so count(false) == 1 with NULL you are counting zero things count(null) == 0 On Wed, Nov 27, 2013 at 1:54 PM, Daevid Vincent <daevid@xxxxxxxxxx> wrote: > > > > -----Original Message----- > > From: Aziz Saleh [mailto:azizsaleh@xxxxxxxxx] > > Sent: Wednesday, November 27, 2013 10:15 AM > > To: Daevid Vincent > > Cc: php-general@xxxxxxxxxxxxx > > Subject: Re: echo count(false); == 1 ?! > > > > On Wed, Nov 27, 2013 at 1:04 PM, Daevid Vincent <daevid@xxxxxxxxxx> > wrote: > > > > > Really? 1?? I would have expected 0 or false or something other than > > > positive. *sigh* > > > > > > $ php -a > > > php > echo count(false); > > > 1 > > > > > > > > > :-\ > > > > > http://us3.php.net/count > > > > The manual is a great place to figure out why things happen a certain > way. > > The manual page does not explain WHY that logic is used and even > inconsistent since null returns 0. It only says that it does return 1. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >