note 125740 deleted from control-structures.if by crell
| From: | crell@php.net | Date: | Fri, 15 Apr 2022 17:45:29 +0000 |
| Subject: | note 125740 deleted from control-structures.if by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218255@lists.php.net to get a copy of this message | ||
Note Submitter: kemalcelikturk at gmail dot com
----
Normal if example;
if($value["cargostatus"]==0):
echo 'In the Procurement Process';
elseif ($value["cargostatus"]==1):
echo 'In packaging';
elseif ($value["cargostatus"]==2):
echo 'In cargo';
else:
echo 'not specified';
endif;
Multiple comparison operator example in a single line;
($value["cargostatus"] == "0") ? 'In the Procurement Process' :
(($value["cargostatus"] == "1") ? 'In packaging
' : (($value["cargostatus"] == "2") ? 'In cargo' : 'not
specified'))
What should not be forgotten;
After the first query, a parenthesis will be added to the end of each comparison.