note 96757 added to function.array-intersect
| From: | nineff at gmail dot com | Date: | Sun, 14 Mar 2010 19:34:08 +0000 |
| Subject: | note 96757 added to function.array-intersect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-167017@lists.php.net to get a copy of this message | ||
@189780 at gmail dot com:
well your function may be faster but it behaves very different than array_intersect:
<?php
function my_array_intersect()
{
// ... definition see below
}
$array1 = array(1,2,3,4);
$array2 = array(1,1,1,1,4);
$result = array_intersect($array1, $array2);
print_r($result);
/*
Array
(
[0] => 1
[3] => 4
)
*/
$array1 = array(1,2,3,4);
$array2 = array(1,1,1,1,4);
$result = my_array_intersect($array1, $array2);
print_r($result);
/*
Array
(
[0] => 1
[1] => 1
[2] => 1
[3] => 1
)
*/
?>
----
Server IP: 69.147.83.197
Probable Submitter: 84.170.3.236
----
Manual Page -- http://www.php.net/manual/en/function.array-intersect.php
Edit -- https://master.php.net/note/edit/96757
Del: integrated -- https://master.php.net/note/delete/96757/integrated
Del: useless -- https://master.php.net/note/delete/96757/useless
Del: bad code -- https://master.php.net/note/delete/96757/bad+code
Del: spam -- https://master.php.net/note/delete/96757/spam
Del: non-english -- https://master.php.net/note/delete/96757/non-english
Del: in docs -- https://master.php.net/note/delete/96757/in+docs
Del: other reasons-- https://master.php.net/note/delete/96757
Reject -- https://master.php.net/note/reject/96757
Search -- https://master.php.net/manage/user-notes.php