note 89916 added to language.types.type-juggling

From: Date: Sat, 28 Mar 2009 19:40:38 +0000
Subject: note 89916 added to language.types.type-juggling
Groups: php.notes 
Request: Send a blank email to php-notes+get-152556@lists.php.net to get a copy of this message
Here is something that was a not obvious bug in my code. Comparison statements cast string to int automatically if one of the other variable is an int. $a=3; $b='3d'; if ($a==$b) { echo "a is b"; } else { echo "a is not b"; } Result: a is b This can cause some issues if you don't expect it ---- Server IP: 72.55.140.6 Probable Submitter: 70.78.5.74 ---- Manual Page -- http://www.php.net/manual/en/language.types.type-juggling.php Edit -- https://master.php.net/note/edit/89916 Del: integrated -- https://master.php.net/note/delete/89916/integrated Del: useless -- https://master.php.net/note/delete/89916/useless Del: bad code -- https://master.php.net/note/delete/89916/bad+code Del: spam -- https://master.php.net/note/delete/89916/spam Del: non-english -- https://master.php.net/note/delete/89916/non-english Del: in docs -- https://master.php.net/note/delete/89916/in+docs Del: other reasons-- https://master.php.net/note/delete/89916 Reject -- https://master.php.net/note/reject/89916 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#152556) next »