note 47000 deleted from control-structures.else by nlopess
| From: | nlopess@php.net | Date: | Thu, 11 Aug 2005 11:36:16 +0000 |
| Subject: | note 47000 deleted from control-structures.else by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-93422@lists.php.net to get a copy of this message | ||
Note Submitter: stephen at dotnetbytes dot com
----
me, being a c/c++ programer, would be lazy and try to type as few characters as possible so that
last statement:
echo "You have $i ". ($i==1 ? "message" : "messages"). " in your
mailbox.\n";
can become:
echo "You have $i message".($i-1?"s":"")." in your
mailbox.\n";
since if $i is 1 it ($i-1) would result in a 0 and evaluate as false. But if $i is more than 1 will
be a positive integer and evaluate as true and add the 's'.