note 20810 deleted from language.operators.logical by betz

From: Date: Mon, 01 Nov 2004 14:06:41 +0000
Subject: note 20810 deleted from language.operators.logical by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79448@lists.php.net to get a copy of this message
Note Submitter: destes at ix dot netcom dot com dot nospam ---- If you're like me, staring at the definition of the !$var syntax, you might be wondering how you can use this to test whether a variable exists, or quickly compare its value in a slap-dash fashion. For instance, my programs use config files where most of the values are stored either as integers 0 or 1, indicating whether the option is on or off. After sifting through the documentation, here's the section I found: http://www.php.net/manual/en/language.types.boolean.php (scroll to the "Converting to Boolean" header) For the reasons in that section, this approach will work. Part of it states that: if ($var) { ... is the same as stating: if ($var == true) { ... And in the same sense, (!$var) is the same as ($var == false). Read the above link for the specifics.

« previous php.notes (#79448) next »