note 61596 added to function.array-intersect
| From: | -dot-) | Date: | Tue, 07 Feb 2006 15:42:53 +0000 |
| Subject: | note 61596 added to function.array-intersect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-103203@lists.php.net to get a copy of this message | ||
I couldn't get array_intersect to work with two arrays of identical objects, so I just did
this:
foreach ($firstarray as $key=>$value){
if (!in_array($value,$secondarray)){
unset($firstarray[$key]);
}
}
This leaves $firstarray as the intersection.
Seems to work fine & reasonably quickly.
----
Server IP: 85.116.0.130
Probable Submitter: 217.204.173.194
----
Manual Page -- http://www.php.net/manual/en/function.array-intersect.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61596
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61596&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61596&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61596&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61596&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61596&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61596&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61596&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61596&report=yes
Search -- http://master.php.net/manage/user-notes.php