note 50100 added to language.control-structures
| From: | dotwho at nospam dot mac dot com | Date: | Fri, 18 Feb 2005 01:12:33 +0000 |
| Subject: | note 50100 added to language.control-structures | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-85187@lists.php.net to get a copy of this message | ||
As of php 5.01:
if using the short cut if - else syntax:
condition ? true : false;
be careful. inside of condition the and / or operators do not work as expected. use instead
&& / ||.
Example:
<?php
$sText = (!isset($searchText) or $sText === "" ? "NULL" : $sText);
?>
Always sets $sText to "1".
<?php
$sText = (!isset($searchText) || $sText === "" ? "NULL" : $sText);
?>
Sets $sText appropriately.
----
Manual Page -- http://www.php.net/manual/en/language.control-structures.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+50100
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50100&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50100&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50100&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50100&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50100&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+50100&report=yes
Search -- http://master.php.net/manage/user-notes.php