note 39153 deleted from control-structures by didou
| From: | didou@php.net | Date: | Wed, 25 Feb 2004 10:55:56 +0000 |
| Subject: | note 39153 deleted from control-structures by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65702@lists.php.net to get a copy of this message | ||
Note Submitter: MageOfChrisz@Diabloworld.com
----
As the person said below, you for assigning variables, you can use:
<?PHP
$foo = 1;
$bar = 2;
$foobar = ($foo == 1) ? $foo + $bar : $bar;
?>
Which is saying
VARIABLE = (IF STATEMENT) ? If the statement is true: if it's false;
You can even have and / or / xor in it
<?PHP
$foo = 1;
$bar = 2;
$foobar = ( ($foo == 1) && ($bar == 2) ) ? 3 : 1;
?>