From: bart at mediawave dot nl
Operating system: WinXP
PHP version: 5CVS-2005-02-11 (dev)
PHP Bug Type: Arrays related
Bug description: in_array() not working with array containing strings as needle
Description:
------------
in_array() doesn't work with an array containing strings (larger then one
character) as a needle.
Reproduce code:
---------------
<?php
$a = array(array("Mac", "NT"), array("Irix", "Linux"), "OS2");
if (in_array(array("NT", "Linux"), $a)) {
echo "NT Linux found\n";
}
if (in_array(array("XP", "Unix"), $a)) {
echo "XP Unix found\n";
}
if (in_array("OS2", $a)) {
echo "OS2 found\n";
}
?>
Expected result:
----------------
NT Linux found
OS2 found
Actual result:
--------------
OS2 found
--
Edit bug report at http://bugs.php.net/?id=31927&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31927&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=31927&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=31927&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31927&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31927&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31927&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31927&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31927&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31927&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31927&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=31927&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=31927&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31927&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31927&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31927&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31927&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31927&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31927&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31927&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31927&r=mysqlcfg