Use array_intersect_key with array_flip.

$pending_pick_key1 = [uid, username];
array_intersect_key($origin_array, array_flip( $pending_pick_key1));
On Jun 17, 2015 7:25 PM, "Netroby" <hufeng1...@gmail.com> wrote:

> Now, we have a large array, contains user profile.
> [uid, username, password, email, qq, msn, skype, address, zipcode,
> telphone, mobile.......]
>
> We need to pick information from this big array, and we know the key
> we want to pick.
> What's the efficient way ? Is there any function like
>
> $pending_pick_key1 = [uid, username];
> array_pick($origin_array,  $pending_pick_key1);  //return array
> contains [uid, username]
>
> $pending_pick_key2 = [username, password];
> array_pick($origin_array, $pending_pick_key2); //return array contains
> [username, password]
>
>
> we current using array_filter and pass function into it to do this job.
> But it's not fast as we test.
>
> Any other ideas beside array_filter?
>
> Or we have to implement an php extension to do this job ?
>
> Sorry for trouble you. need your help.
>
>
> Appreciate your time.
> ----------------------------
> Netroby
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to