note 103597 added to language.operators.comparison

From: Date: Thu, 21 Apr 2011 18:18:51 +0000
Subject: note 103597 added to language.operators.comparison
Groups: php.notes 
Request: Send a blank email to php-notes+get-179058@lists.php.net to get a copy of this message
be careful when trying to concatenate the result of a ternary operator to a string print '<div>'.(FALSE) ? 'TRUE [bad ternary]' : 'FALSE [bad ternary]'; print '<br><br>'; print '<div>'.((FALSE) ? 'TRUE [good ternary]' : 'FALSE [good ternary]'); yields: TRUE [bad ternary] FALSE [good ternary] this is because the ternary evaluates '<div>'.(FALSE) not (FALSE) - so the end result is TRUE ---- Server IP: 69.147.83.197 Probable Submitter: 169.200.185.24 ---- Manual Page -- http://www.php.net/manual/en/language.operators.comparison.php Edit -- https://master.php.net/note/edit/103597 Del: integrated -- https://master.php.net/note/delete/103597/integrated Del: useless -- https://master.php.net/note/delete/103597/useless Del: bad code -- https://master.php.net/note/delete/103597/bad+code Del: spam -- https://master.php.net/note/delete/103597/spam Del: non-english -- https://master.php.net/note/delete/103597/non-english Del: in docs -- https://master.php.net/note/delete/103597/in+docs Del: other reasons-- https://master.php.net/note/delete/103597 Reject -- https://master.php.net/note/reject/103597 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#179058) next »