#42131 [Opn->Bgs]: in_array return 0 value when there's no specified 0 value in array
| From: | johannes@php.net | Date: | Sat, 28 Jul 2007 12:26:11 +0000 |
| Subject: | #42131 [Opn->Bgs]: in_array return 0 value when there's no specified 0 value in array | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-115517@lists.php.net to get a copy of this message | ||
ID: 42131
Updated by: johannes@php.net
Reported By: mitch dot pascual at phpugph dot com
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Windows XP
PHP Version: 5.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
.
Previous Comments:
------------------------------------------------------------------------
[2007-07-28 11:58:29] mitch dot pascual at phpugph dot com
Description:
------------
return 0 value when there's no specified 0 value in array
Reproduce code:
---------------
<?php
$array1 = array(php, java, ruby, asp);
$array2 = array(php => PHP.net, java => java.com, 0 =>
javascript, 1 => actionscript);
foreach ($array2 as $key => $value) {
if ( in_array($key, $array1) ) {
print in array: $key <br />;
} else {
print not in array: $key <br />;
} # end if
} # end foreach
?>
Expected result:
----------------
in array: php
in array: java
not in array: 0
not in array: 1
Actual result:
--------------
in array: php
in array: java
in array: 0
not in array: 1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42131&edit=1