note 13049 added to language.operators.logical.php
| From: | klokie at surface2air dot NO_SPAM dot com | Date: | Thu, 24 May 2001 02:00:26 +0000 |
| Subject: | note 13049 added to language.operators.logical.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14240@lists.php.net to get a copy of this message | ||
>>$choice1 = "";
>>$choice2 = "dog";
>>$default = "other";
>>$val = $choice1 or $choice2 or >>$default;
>>now $val contained the string "dog".
This assignment practice doesn't work on my system (PHP 4.0.5/ISAPI): $val == ''.
Better to use something like:
$val = !empty($choice1) ? $choice1 : $choice2;
http://www.php.net/manual/en/language.operators.logical.php