note 96757 deleted from function.array-intersect by danbrown

From: Date: Mon, 15 Mar 2010 16:19:46 +0000
Subject: note 96757 deleted from function.array-intersect by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-167038@lists.php.net to get a copy of this message
Note Submitter: nineff at gmail dot com ---- @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 ) */ ?>

« previous php.notes (#167038) next »