Re: Booleans compared to strings [message #181375 is a reply to message #181372] |
Mon, 13 May 2013 22:41 |
Thomas 'PointedEars'
Messages: 701 Registered: October 2010
Karma:
|
Senior Member |
|
|
The Natural Philosopher wrote:
> On 13/05/13 22:46, Thomas 'PointedEars' Lahn wrote:
>> M. Strobel wrote:
>>> Am 13.05.2013 22:24, schrieb Doug Cassidy:
>>>> On Monday, May 13, 2013 6:13:11 AM UTC-7, Jerry Stuckle wrote:
>>>> > On 5/13/2013 8:29 AM, Doug Cassidy wrote:
>>>> >> I dont see why boolean true is equal to string false in any way.
>>>> > A string comparison returns false only if the string is NULL, is an
>>>> > empty string ('') or contains a zero ('0'). All other values
>>>> > (including 'false') are true.
>>>> got it, thanks
>>> My favourite link to comparison in PHP is
>>> http://www.php.net/manual/en/types.comparisons.php
>>> where you have also the "if ($x)" results.
>>>
>>> Highly recommended.
>> Slighty off, though, because “if” is _not_ a function.
> Semantics. It behaves like one, takes two variables and returns a value.
I am not usually reading your postings because of your notorious address
munging and anonymous posting, but really …
What the *heck* are you talking about? An “if” *statement* does not return
anything (in neither programming language where it is a statement), and it
does not “take two variables”. It is the *one* “parameter” (for lack of a
better word) to the statement that is evaluated to a value, which is then
converted to boolean, which then determines whether or not the adjacent
statement is executed.
PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
|
|
|