note 63797 added to function.array-intersect-key

From: Date: Fri, 31 Mar 2006 07:49:50 +0000
Subject: note 63797 added to function.array-intersect-key
Groups: php.notes 
Request: Send a blank email to php-notes+get-107060@lists.php.net to get a copy of this message
Jesse: no, array_intersect_key does not accomplish the same thing as what you posted: array_flip (array_intersect (array_flip ($a), array_flip ($b))) because when the array is flipped, values become keys. having duplicate values is not a problem, but having duplicate keys is. array_flip resolves it by keeping only one of the duplicates and discarding the rest. by the time you start intersecting, you've already lost information. ---- Server IP: 64.71.164.2 Probable Submitter: 137.99.177.212 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.array-intersect-key.php Edit -- http://master.php.net/note/edit/63797 Del: integrated -- http://master.php.net/note/delete/63797/integrated Del: useless -- http://master.php.net/note/delete/63797/useless Del: bad code -- http://master.php.net/note/delete/63797/bad+code Del: spam -- http://master.php.net/note/delete/63797/spam Del: non-english -- http://master.php.net/note/delete/63797/non-english Del: in docs -- http://master.php.net/note/delete/63797/in+docs Del: other reasons-- http://master.php.net/note/delete/63797 Reject -- http://master.php.net/note/reject/63797 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#107060) next »