note 92484 added to control-structures.if

From: Date: Mon, 27 Jul 2009 00:17:41 +0000
Subject: note 92484 added to control-structures.if
Groups: php.notes 
Request: Send a blank email to php-notes+get-158753@lists.php.net to get a copy of this message
If you want to compare 2 variables, where the first is a integer and the second could both integer or a string, you should be very careful. Example: if($var_1 == $var_2) { echo "They match"; } else { echo "They do not match": } if $var_1 and $var_2 is both the same number, it will of course write "They match", and if they are not then it will write "They do not match" However if $var_1 is 0 and $var_2 is forexample "unlimited", then it will write "They match". ---- Server IP: 195.184.96.15 Probable Submitter: 85.82.157.183 ---- Manual Page -- http://www.php.net/manual/en/control-structures.if.php Edit -- https://master.php.net/note/edit/92484 Del: integrated -- https://master.php.net/note/delete/92484/integrated Del: useless -- https://master.php.net/note/delete/92484/useless Del: bad code -- https://master.php.net/note/delete/92484/bad+code Del: spam -- https://master.php.net/note/delete/92484/spam Del: non-english -- https://master.php.net/note/delete/92484/non-english Del: in docs -- https://master.php.net/note/delete/92484/in+docs Del: other reasons-- https://master.php.net/note/delete/92484 Reject -- https://master.php.net/note/reject/92484 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#158753) next »