Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:11405 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77998 invoked by uid 1010); 21 Jul 2004 00:52:48 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 77923 invoked from network); 21 Jul 2004 00:52:48 -0000 Received: from unknown (HELO theta.altoona-pa.com) (209.161.72.28) by pb1.pair.com with SMTP; 21 Jul 2004 00:52:48 -0000 Received: from IONZOFT-JEG (dpvc-207-68-114-163.alt.east.verizon.net [207.68.114.163]) by theta.altoona-pa.com (Postfix) with ESMTP id 8CCB21531F for ; Tue, 20 Jul 2004 20:52:47 -0400 (EDT) Date: Tue, 20 Jul 2004 20:52:47 -0400 X-Mailer: The Bat! (v2.11.02) Business Reply-To: Jason Garber Organization: IonZoft, Inc. X-Priority: 3 (Normal) Message-ID: <1202957452.20040720205247@ionzoft.com> To: internals@lists.php.net In-Reply-To: <20040720192358.26985.qmail@pb1.pair.com> References: <20040720192358.26985.qmail@pb1.pair.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] array_intersect_key From: jason@ionzoft.com (Jason Garber) Hello Cristiano, First, I'd like to say that a function of this type sounds useful. It's one that I've wanted for some time, particularly for verifying that an array has the correct keys when it is passed as a function parameter. If I understand what you are doing correctly, the same thing can be accomplished by: array_intersect(array_keys($records), array(234, 567, 890, 123)) However, I agree that array_diff_key() and array_intersect_key() would be significantly useful functions to add to the core. -- Best regards, Jason mailto:jason@ionzoft.com Tuesday, July 20, 2004, 3:16:20 PM, you wrote: CD> Hi all, CD> I needed to intersect an array with database records indexed by the primary CD> key, with an array with keys and there is no php function that will do it CD> internally. CD> The database array looks like: CD> $records = array ( 2587 => array('Name', 'Address', 'zip'), ...);