note 89367 deleted from function.array-intersect by danbrown

From: Date: Wed, 04 Mar 2009 21:06:54 +0000
Subject: note 89367 deleted from function.array-intersect by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-151485@lists.php.net to get a copy of this message
Note Submitter: chris ---- Is there a simple way to find the intersection of arrays which are in an array? There is an array, which contains an undetermined amount of arrays, and I need to array_intersect() those arrays. $masterAr = array( array(1,3,7,8), array(3,6,8,17,5,7,83), array(4,8,3), ... ) I would need the solution to return array(8,3) for the above example. array_intersect($master[0], $master[1] ...) is not possible, since it is unknown how many elements it will contain. And of course, I could create an array_filter function... but that's much dirtier. If this were a feature request, I would vote for simply passing one array to this function, and having it check if the elements are arrays. Thanks!

« previous php.notes (#151485) next »