note 13906 deleted from function.array-intersect.php by zak
| From: | zak@php.net | Date: | Tue, 10 Jul 2001 02:07:21 +0000 |
| Subject: | note 13906 deleted from function.array-intersect.php by zak | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15143@lists.php.net to get a copy of this message | ||
If you are intersecting a "normal index" array with an array that has an associative index
and you want to keep the associative index, put the associative array as the second argument:
$AssociativeArray["cat"] = "Fluffy";
$AssociativeArray["dog"] = "Wetspot";
$WhichToAdoptArray[] = "Fluffy";
$Intersected_One = array_intersect ($AssociativeArray,$WhichToAdoptArray);
$Intersected_Two = array_intersect ($WhichToAdoptArray,$AssociativeArray);
$Intersected_One will be look like:
$Intersected_One[0] == "Fluffy";
but $Intersected_Two will be:
$Intersected_Two["cat"] == "Fluffy";