Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93620 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5305 invoked from network); 29 May 2016 13:14:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 May 2016 13:14:03 -0000 Authentication-Results: pb1.pair.com smtp.mail=colinodell@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=colinodell@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.48 as permitted sender) X-PHP-List-Original-Sender: colinodell@gmail.com X-Host-Fingerprint: 209.85.218.48 mail-oi0-f48.google.com Received: from [209.85.218.48] ([209.85.218.48:35428] helo=mail-oi0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 58/11-23584-81BEA475 for ; Sun, 29 May 2016 09:14:00 -0400 Received: by mail-oi0-f48.google.com with SMTP id w184so229655501oiw.2 for ; Sun, 29 May 2016 06:14:00 -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:cc; bh=yDb9vqOpVnBR7y5GvwIagJQqE3zMdjvk/pK2EN7DvA4=; b=gprjEAqpSzImIY/UH6YiQ9PzARgvvxkZ/iDyD2MjthM6lCxtLdvkqHLLpAt8iiVrX0 QnxcDnttvQ9v9z6PEM+3db32VGxe6K3MjctagWC//5mFpYJMQ3huge2WfUAr+5YTkV+n +gFTwUDn1a6XcIfo0ujONqcZFPgbNMhPdTCCbbs3ka0FgXCA8Z3X5gqJoMqWsf9i5VY7 jO2lHCH3dIf3bwvOq4c+hTP/g5qOevjsdzKbsKBnGXMD74/wkWXDo3PkWIRrGuZ1w5rV yFOciPZipB4VjX6EUbsPajKzure08o0Dav+JxTgety1sMqiJ4DCrVONR0P2spw4LKcFM it6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=yDb9vqOpVnBR7y5GvwIagJQqE3zMdjvk/pK2EN7DvA4=; b=O3oeQ5F07dGHWoSMu2tKemlBpW9/QB5RFR8IoLfesoSnIj1xIjuR/dgb847Zn8uIsR TI7F+YkpnwVq0TZPs6OvM5kWB3WC5Wzr2SJexIbC65yhR2/XtBzBlMplhBTFvLeHxJyC 7QsZ3ek1TUoGwm8pg1qol7cN5s7n66uQJzGuQp6jup1cESm+XIgPIfbHL7bs2CKiFsxD o/a4WZGSM/bxH77vS1Znhdes2wBiDCzjPV3YvXEuEL3N/k/mluq+OuSlw2IRPngf10V+ geCGV2Kkxy0TKSYJj8w8v3I+JVJGsROSvDqrtatSnyko0Nrpko2mW5DacUQQXymOXWw3 iEdQ== X-Gm-Message-State: ALyK8tK+dvO2QpMqh8YhAZbk1yZHhYimiTardKysX77cJ4qqVskJnqispn0S2TygBer1lQAGkRu61TOfOH7qKQ== X-Received: by 10.157.8.240 with SMTP id 103mr13781849otf.109.1464527636879; Sun, 29 May 2016 06:13:56 -0700 (PDT) MIME-Version: 1.0 Date: Sun, 29 May 2016 13:13:47 +0000 Message-ID: To: PHP Internals Cc: jmikola@gmail.com Content-Type: multipart/alternative; boundary=001a113703f08f60210533fae935 Subject: [RFC Discussion] array_change_keys() From: colinodell@gmail.com ("Colin O'Dell") --001a113703f08f60210533fae935 Content-Type: text/plain; charset=UTF-8 Hello everyone, I'd like to introduce a new RFC for your consideration and discussion: https://wiki.php.net/rfc/array_change_keys This would add a new function named array_change_keys() which simplifies the process of re-keying an array. PHP currently has an array_change_key_case() method, but this only allows keys to be changed to upper- or lower-case; no method exists to change the keys to some custom user-defined value. Although it's absolutely possible to accomplish this without a special function, the alternate approaches have several drawbacks: - Slower execution time compared to the proposed implementation. - Multiple lines and/or function calls are required. - Harder to understand the code's purpose with a quick glance. - The result of a "foreach" approach cannot be passed into another function without using an intermediate variable. A working implementation has been included with the RFC (huge thanks to Jeremy Mikola for the heavy lifting here!) I've also requested this patch be added to 3v4l.org; I'll notify everyone if/when that happens. I'd greatly appreciate if you could review this RFC and let me know your thoughts. I'd be happy to answer any questions you might have. Regards, Colin O'Dell --001a113703f08f60210533fae935--