note 44876 added to control-structures.else
| From: | joshuaat-removethispurdue dot edu at osu1 dot php dot net | Date: | Wed, 18 Aug 2004 18:00:33 +0000 |
| Subject: | note 44876 added to control-structures.else | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-74894@lists.php.net to get a copy of this message | ||
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)
----
Manual Page -- http://www.php.net/manual/en/control-structures.else.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44876
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44876&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44876&report=yes
Search -- http://master.php.net/manage/user-notes.php