#20032 [NEW]: Array_intersect function doesnt seem to work correctly
| From: | lalande at idbconsulting dot com | Date: | Tue, 22 Oct 2002 21:26:43 +0000 |
| Subject: | #20032 [NEW]: Array_intersect function doesnt seem to work correctly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-23067@lists.php.net to get a copy of this message | ||
From: lalande@idbconsulting.com
Operating system: Linux Debian kernel 2.4.19
PHP version: 4.2.3
PHP Bug Type: Arrays related
Bug description: Array_intersect function doesnt seem to work correctly
Script :
<?
$tab1 = array(1,2,3,4,5,6,7,8,9,0);
$tab2 = array(2,4,6,8,0);
$rs = array_intersect($tab1,$tab2);
for($i = 0; $i<sizeof($rs);$i++)
{
echo $rs[$i]."<br>";
}
echo "<hr>";
$rs = array_intersect($tab2,$tab1);
for($i = 0; $i<sizeof($rs);$i++)
{
echo $rs[$i]."<br>";
}
?>
Output :
2
4
------------------------------------------------------------2
4
6
8
0
according to the documentation, array_intersect should give the same
result independently of the order of parameters.
--
Edit bug report at http://bugs.php.net/?id=20032&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=20032&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=20032&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=20032&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=20032&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=20032&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=20032&r=support
Expected behavior: http://bugs.php.net/fix.php?id=20032&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=20032&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=20032&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=20032&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20032&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=20032&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=20032&r=isapi