Re: array_intersect_key
| From: | Jason Garber | Date: | Wed, 21 Jul 2004 00:52:47 +0000 |
| Subject: | Re: array_intersect_key | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-11405@lists.php.net to get a copy of this message | ||
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'),
...);