[PHP] Re: Having problems with an IF statement, just doesn't make sense
Paying attention to this line: > Also if I use !isset it returns true with a null value for $theme Well this is clear in the manual: isset() will return FALSE if testing a variable that has been set to NULL So !isset($a_Null) = !FALSE = TRUE >From PHP Manual = $var = 0; if (empty($var)) { // evaluates true echo '$var is either 0 or not set at all'; } if (!isset($var)) { // evaluates false echo '$var is not set at all'; } Read manual: empty() and isset() -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Having problems with an IF statement, just doesn't make sense
I've tried...print nothing in my browser then it seems to me correct. The condition "ELSE" is satisfied. bye. codeused: if (isset($theme)) { print("Current theme is $theme"); require "content/header_$theme.php"; } else { print("$theme"); require "content/header.php"; } codeused. "Bobb" <[EMAIL PROTECTED]> ha scritto nel messaggio news:[EMAIL PROTECTED] > I am using the following if statement ... > > if (isset($theme)) { > print("Current theme is $theme"); > require "content/header_$theme.php"; > } else { > print("$theme"); > require "content/header.php"; > } > > now one would think that if it didn't return true that the else > statement wouldn't print anything for $theme ... but it does. Also if I > use !isset it returns true with a null value for $theme ... This doesn't > make sense to me ... maybee I am doing something wrong, if I am someone > please correct me heh. > > -- > /* BoBB > * AIM: Jodokast49 ICQ: 151495596 > * Jabber: [EMAIL PROTECTED] > * http://knightsofchaos.com/~BoBB/new/ > * I geek, therefor I am. > */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Having problems with an IF statement, just doesn't make sense
> if (isset($theme)) { > print("Current theme is $theme"); > require "content/header_$theme.php"; if you try to send headers in "header_$theme.php", this wont work, because you can't send headers after you've printed or echoed something. try this: if (isset($theme)) { require "content/header_$theme.php"; print("Current theme is $theme"); } else { require "content/header.php"; print("$theme"); } mfg. harry wiens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php