note 73922 added to language.operators.comparison

From: Date: Thu, 15 Mar 2007 19:05:59 +0000
Subject: note 73922 added to language.operators.comparison
Groups: php.notes 
Request: Send a blank email to php-notes+get-124489@lists.php.net to get a copy of this message
Here's a PHP peculiarity: <? echo ( 0==true ? "true" : "false") . "\n"; echo ( 1==true ? "true" : "false") . "\n"; echo ( 596==true ? "true" : "false") . "\n"; ?> produces: false true true no surprises, so far, and... <? echo ( 0=="true" ? "true" : "false") . "\n"; echo ( 1=="true" ? "true" : "false") . "\n"; echo ( 596=="true" ? "true" : "false") . "\n"; ?> produces: true false false still okay, but this... <? echo ( true=="true" ? "true" : "false") . "\n"; ?> produces: true !? what's up? it's kind of like... <? echo ( sally=="sally" ? "true" : "false") . "\n"; ?> which produces: true but it should be more like.. <? define("sally",1); echo ( sally=="sally" ? "true" : "false") . "\n"; ?> which produces: false Can anybody explain this peculiar behaviour? ---- Server IP: 216.235.15.211 Probable Submitter: 66.11.77.89 ---- Manual Page -- http://www.php.net/manual/en/language.operators.comparison.php Edit -- https://master.php.net/note/edit/73922 Del: integrated -- https://master.php.net/note/delete/73922/integrated Del: useless -- https://master.php.net/note/delete/73922/useless Del: bad code -- https://master.php.net/note/delete/73922/bad+code Del: spam -- https://master.php.net/note/delete/73922/spam Del: non-english -- https://master.php.net/note/delete/73922/non-english Del: in docs -- https://master.php.net/note/delete/73922/in+docs Del: other reasons-- https://master.php.net/note/delete/73922 Reject -- https://master.php.net/note/reject/73922 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#124489) next »