note 73519 added to language.operators.comparison

From: Date: Tue, 27 Feb 2007 17:37:23 +0000
Subject: note 73519 added to language.operators.comparison
Groups: php.notes 
Request: Send a blank email to php-notes+get-123925@lists.php.net to get a copy of this message
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. ---- Server IP: 194.145.210.4 Probable Submitter: 81.86.162.169 ---- Manual Page -- http://www.php.net/manual/en/language.operators.comparison.php Edit -- https://master.php.net/note/edit/73519 Del: integrated -- https://master.php.net/note/delete/73519/integrated Del: useless -- https://master.php.net/note/delete/73519/useless Del: bad code -- https://master.php.net/note/delete/73519/bad+code Del: spam -- https://master.php.net/note/delete/73519/spam Del: non-english -- https://master.php.net/note/delete/73519/non-english Del: in docs -- https://master.php.net/note/delete/73519/in+docs Del: other reasons-- https://master.php.net/note/delete/73519 Reject -- https://master.php.net/note/reject/73519 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#123925) next »