note 44876 deleted from control-structures.else by tomsommer
| From: | tomsommer@php.net | Date: | Wed, 18 Aug 2004 19:30:17 +0000 |
| Subject: | note 44876 deleted from control-structures.else by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-74903@lists.php.net to get a copy of this message | ||
Note Submitter: joshua at-removethis purdue.edu
----
If you want to know more about the "mysterious" php if statements that are small and one
line, see the syntax and link below:
<?php
$var = ($foo) ? 'true' : 'false';
?>
This works because we have used a syntax that takes advantage of what those trained programmers call
a ternary operator (the other comment on this page helped me!). For more information, please see http://www.php.net/operators.comparison in the
manual.
(This is essentially an if statement, why is it not in the manual or referenced? not sure... it took
me over 20 minutes to figure it out)