Jump to content

Multi-variable if statements


lice200

Recommended Posts

That's because the value "Sun" is true (always). I mean- even if you set the value of $day to "foo", the statement will be true.

As said in the manual, in the section about booleans (link [url=http://www.php.net/manual/en/language.types.boolean.php]here[/url]):
[quote] When converting to boolean, the following values are considered FALSE:
-the boolean FALSE itself
-the integer 0 (zero)
-the float 0.0 (zero)
-the empty string, and the string "0"
-an array with zero elements
-an object with zero member variables (PHP 4 only)
-the special type NULL (including unset variables)
-SimpleXML objects created from empty tags

Every other value is considered TRUE (including any resource).[/quote]

Look at the last line ;)

Orio.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.