note 110544 added to function.array-intersect
| From: | JP | Date: | Mon, 05 Nov 2012 01:46:54 +0000 |
| Subject: | note 110544 added to function.array-intersect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-191654@lists.php.net to get a copy of this message | ||
// set intersection of arrays. eliminates duplicates.
function array_intersection( $a1, $a2) {
$result = Array();
foreach ( $a1 as $val){
if ( (!in_array( $val, $result, true)) && in_array( $val, $a2, true)) {
$result[] = $val;
}
}
return $result;
}
----
Server IP: 69.147.83.199
Probable Submitter: 128.8.132.91
----
Manual Page -- http://www.php.net/manual/en/function.array-intersect.php
Edit -- https://master.php.net/note/edit/110544
Del: integrated -- https://master.php.net/note/delete/110544/integrated
Del: useless -- https://master.php.net/note/delete/110544/useless
Del: bad code -- https://master.php.net/note/delete/110544/bad+code
Del: spam -- https://master.php.net/note/delete/110544/spam
Del: non-english -- https://master.php.net/note/delete/110544/non-english
Del: in docs -- https://master.php.net/note/delete/110544/in+docs
Del: other reasons-- https://master.php.net/note/delete/110544
Reject -- https://master.php.net/note/reject/110544
Search -- https://master.php.net/manage/user-notes.php