Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93631 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47902 invoked from network); 30 May 2016 03:20:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 May 2016 03:20:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=come@opensides.be; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=come@opensides.be; sender-id=pass Received-SPF: pass (pb1.pair.com: domain opensides.be designates 195.154.20.141 as permitted sender) X-PHP-List-Original-Sender: come@opensides.be X-Host-Fingerprint: 195.154.20.141 smtp.opensides.be Received: from [195.154.20.141] ([195.154.20.141:57206] helo=smtp.opensides.be) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5D/E0-36420-981BB475 for ; Sun, 29 May 2016 23:20:42 -0400 Received: from localhost (localhost [127.0.0.1]) by smtp.opensides.be (Postfix) with ESMTP id E6D481253EA for ; Mon, 30 May 2016 05:20:38 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at opensides.be Received: from smtp.opensides.be ([127.0.0.1]) by localhost (smtp.opensides.be [127.0.0.1]) (amavisd-new, port 10024) with LMTP id tuglezzW8Uqi for ; Mon, 30 May 2016 05:20:37 +0200 (CEST) Received: from mcmic-probook.localnet (cm-58-9-146-8.revip16.asianet.co.th [58.9.146.8]) by smtp.opensides.be (Postfix) with ESMTPSA id 73D861253B6 for ; Mon, 30 May 2016 05:20:37 +0200 (CEST) To: internals@lists.php.net Date: Mon, 30 May 2016 05:17 +0200 Message-ID: <2845716.HLhsui8PTI@mcmic-probook> Organization: OpenSides User-Agent: KMail/4.14.1 (Linux/3.16.0-4-amd64; KDE/4.14.2; x86_64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1476777.fIeSMB4I7X"; micalg="pgp-sha256"; protocol="application/pgp-signature" Subject: Re: [PHP-DEV] [RFC Discussion] array_change_keys() From: come@opensides.be (=?ISO-8859-1?Q?C=F4me?= Chilliet) --nextPart1476777.fIeSMB4I7X Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Le lundi 30 mai 2016, 01:40:21 Colin O'Dell a =C3=A9crit : > Marco, >=20 >=20 > > 1. could you also provide the code for the benchmarks? I'd gladly = measure > > them with an accurate tool > > >=20 > Yeah that would be great! Here's the benchmark I was using: > https://gist.github.com/colinodell/872c1f0c92351af687347c0c8be4f253 >=20 >=20 > > 2. do we really need another array function that is basically an > > `array_combine(array_map($someFunc, array_keys($arr)), $arr)`? > > >=20 > While array_combine() technically works, the callback does not have a= ccess > to both the key AND value. Anyone needing access to both must curren= tly > resort to using a foreach loop (unless there's some other clever > combination of functions that I'm missing). Yes there is: array_combine( =09array_map($someFunc, array_keys($arr), $arr),=20 =09$arr ) This way $someFunc gets key as first argument and value as second. (you= might use array_values($arr) instead of $arr but I=E2=80=99m not sure = it=E2=80=99s worth it) C=C3=B4me --nextPart1476777.fIeSMB4I7X Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJXS7CvAAoJEKhk2MPOyw4AcBEP/0fLIhuSSavrcHyqWIWJDkVU qJG8/uMuYw1HY+t6OyF2HEL+1HQLsVfkQOII+Rv14t6zof69Sc+XaDupHECi0HlD rhCRLzfwSG0oww+1d3SXyTJOriIcQHaghKiY2eUSDal/QUCNQNk2IJOVugW5Tv89 L6ku6OqiTIxg+ImcZL8dJaxAyzAgQ/rXLxLUUmMEuBx+C7f+rqUXLCvXqIUW5zqY Sj1VoqoByQZOqM6E4aEaj+emr/hDZcDXmHD12h42uEeFhtDl0vD3WLBikBeUbLK0 Tf9d/ITgLi4bQtXTLIdkiS+jLuTfuAByutii1IaTh+lGhUDh0UlsBic/PCkCkWA8 sZZ94lah2oYRjNtk528tx5NupbVf5x7Z9j3UJa+FJ+llZv/DNMNt3Y6cgPOSmLXq pZuR72IykVty0jC5BrgGT4M22+ROmahfAnCsd4xj/cJIgB3BLjtA5ECWC+AlcApk fczjWPT7y90VngFln1ieWKvSWRt7Y71tLzfvYsloI+sgo2JXShh72KsJs0/ZgOkT IcLdYX15FfjFxOOad82bcn8PnFdArr+yT7ZjtoioDbF94FHrwMovMluHeEWQbfK6 0UOp4S3xE639tVI/LUV3kQNIGa9qDEdc6db2r7RxTapOUInR0wIJD8EEfX59R9xt ZYj55rJ6tk9DPnHqdF5l =H6Cw -----END PGP SIGNATURE----- --nextPart1476777.fIeSMB4I7X--