note 73519 deleted from language.operators.comparison by crell

From: Date: Thu, 31 Mar 2022 17:36:30 +0000
Subject: note 73519 deleted from language.operators.comparison by crell
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-217867@lists.php.net to get a copy of this message
Note Submitter: thomas dot oldbury at tgohome dot com ---- Be careful when using the ternary operator! The following will not evaluate to the expected result: <?php echo "a string that has a " . (true) ? 'true' : 'false' . " condition in. "; ?> Will print true. Instead, use this: <?php echo "a string that has a " . ((true) ? 'true' : 'false') . " condition in. "; ?> This will evaluate to the expected result: "a string that has a true condition in. " I hope this helps.

« previous php.notes (#217867) next »