RE: [PHP] shorthand "if" notation
| From: | Dan Joseph | Date: | Wed, 11 Jun 2003 14:27:12 +0000 |
| Subject: | RE: [PHP] shorthand "if" notation | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-151073@lists.php.net to get a copy of this message | ||
Hi,
> -----Original Message-----
> I am confused by the shorthand "if" notation.
> For example I just saw this PHP snippet on another forum
Basically:
(condition) ? true : false;
Example:
$var == "red";
($var == "red") ? echo 'true' : echo 'false';
You'll find this comes in handy with things like printf and other places
like that.
-Dan Joseph