The Context of 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[small rant]
This morning's thread on strpos() brings up an interesting point, zero
has a context.

In certain cases 0 is the equivalent of FALSE and in other cases a 0 is
just a 0. In the context of strpos() 0 indicates that the needle is in
the first position of the haystack. If the needle is not found in the
haystack a Boolean FALSE is returned. In this case 0 is not the
equivalent of FALSE.

There are other cases, most of them specific to strings, in which 0 is
not the equivalent of FALSE. Newbies to PHP or certain functions will no
doubt encounter these cases at some point.

Exercise care when using 0 to determine if something is FALSE and
understand that 0 has context.
[/small rant]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux