#21782 [Opn->Bgs]: array key comparision issue(?)
| From: | iliaa@php.net | Date: | Tue, 21 Jan 2003 01:13:14 +0000 |
| Subject: | #21782 [Opn->Bgs]: array key comparision issue(?) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-30756@lists.php.net to get a copy of this message | ||
ID: 21782
Updated by: iliaa@php.net
Reported By: carlos@wfmh.org.pl
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Linux GNU/Debian
PHP Version: 4.2.3
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
0 == 0 hence $key == $val1 is true. Not a bug.
Previous Comments:
------------------------------------------------------------------------
[2003-01-20 15:44:24] carlos@wfmh.org.pl
test.php:
<?php
$val1 = "any";
$test = array("any"=>"any", "3"=>"+3",
"2"=>"+2",
"1"=>"+1", "0"=>"0",
"-1"=>"-1",
"-2"=>"-2", "-3"=>"-3" );
foreach( $test AS $key=>$val )
printf("'%s' vs. '%s' result: %d\n", $val1, $key, ($key == $val1)
);
?>
$ php test.php
'any' vs. 'any' result: 1
'any' vs. '3' result: 0
'any' vs. '2' result: 0
'any' vs. '1' result: 0
'any' vs. '0' result: 1
'any' vs. '-1' result: 0
'any' vs. '-2' result: 0
'any' vs. '-3' result: 0
$ php -v
4.2.3
Shouldn't "'any' vs. '0'" give 0 as result?
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21782&edit=1