Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86740 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57554 invoked from network); 18 Jun 2015 01:24:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jun 2015 01:24:44 -0000 Authentication-Results: pb1.pair.com header.from=hufeng1987@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=hufeng1987@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.177 as permitted sender) X-PHP-List-Original-Sender: hufeng1987@gmail.com X-Host-Fingerprint: 209.85.223.177 mail-ie0-f177.google.com Received: from [209.85.223.177] ([209.85.223.177:35216] helo=mail-ie0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A1/81-46946-CDD12855 for ; Wed, 17 Jun 2015 21:24:44 -0400 Received: by iesa3 with SMTP id a3so45612778ies.2 for ; Wed, 17 Jun 2015 18:24:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=WGemgHnPf2gA1Jhcs2Dp2j3GmW2SZxpIfMrn70j8Z30=; b=aauyFOkukeGKBaanrivBWCmqpo2BfR02kGVIZ+OpSrhpzwoHn6xQNCBRroNirSTXhG 9fmIiugmM6TFi5urzAORRFSfSGvKquRRs6BeN3MmcQ0l2ENLDFV/xDpdUlBCEML3lk2m TWN9iVVmJSVU5t5IYFkApD0QSG27VYeuBngzRC52Rg3ofq7N4ksWopZMUdnAQ+4fNiiX i2gJCX7bBKq4Ba1Mh2doQoe8EhFQdha9tlWoBytdjYGIdOMPiYKm/y6sAj7L5KtOpiPH XrtWp39h5CXHfly1HspVqkAREvv+gtoelbaskmRIp0o6Y4/KooxFB/MKlveHi8RpJB6i yY3Q== X-Received: by 10.107.138.87 with SMTP id m84mr11787379iod.80.1434590680831; Wed, 17 Jun 2015 18:24:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.77.141 with HTTP; Wed, 17 Jun 2015 18:24:20 -0700 (PDT) Date: Thu, 18 Jun 2015 09:24:20 +0800 Message-ID: To: PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: The most efficicient way to pick key,value from a large array From: hufeng1987@gmail.com (Netroby) 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