note 40787 added to control-structures
| From: | phpatcybercowse at rn2 dot php dot net | Date: | Mon, 15 Mar 2004 00:07:00 +0000 |
| Subject: | note 40787 added to control-structures | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-66836@lists.php.net to get a copy of this message | ||
Just to add to what freshprincecharming discovered. When you do a comparsion between 0 and
'1asdf' you get true, but not when comparing 0 and 'asdf'.. A little example
down.
function writeCompare($value1, $value2)
{
echo('<br> Type:'.(gettype($value1).' == '.gettype($value2 )));
echo(' ('.($value1.' == '.$value2).') ANSWER '.($value1 ==
$value2));
}
echo('<pre>');
writeCompare(0, 'asdf'); // (0 == asdf) ANSWER 1
writeCompare(0, '1adf'); // (0 == 1adf) ANSWER
writeCompare(1, 'asdf'); // (1 == asdf) ANSWER
writeCompare(1, '1adf'); // (1 == 1adf) ANSWER 1
echo('</pre>');
----
Manual Page -- http://www.php.net/manual/en/control-structures.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40787
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40787&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40787&report=yes
Search -- http://master.php.net/manage/user-notes.php