Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116107 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 53423 invoked from network); 20 Sep 2021 11:13:47 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 Sep 2021 11:13:47 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 234DF1804C8 for ; Mon, 20 Sep 2021 04:54:30 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 20 Sep 2021 04:54:29 -0700 (PDT) Received: by mail-lf1-f43.google.com with SMTP id z24so40372226lfu.13 for ; Mon, 20 Sep 2021 04:54:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=eyLIN6Q1SMIB6b4nnie6sq5bML3jn9xhnzCj1TgS3pQ=; b=ixdIooFeCewV1skn7C/dmTMtWFxHRoVU6im3N52Jg5gxPtd8BTlBDu/RLaKbgsnn93 ttG1OZAqgTzfpPnuNO/098bD7SEjPJK1T2AFDWAmJqh0M3jOjWxBlT1rDats4n4e0YBM DHo6vHQNoePwNFz/Yd3egsMtt77p9SthP2aSpt4IGzC0tMNgafURe0gm9HNY0UMWEvHl xOvMHpv5RFuBg+lqlhNXp+4+VurBkr9QEQZB+cz0AXpZZ9KZfZiUjjO/YlGINzEQhY49 Vs6X1I259TCbO9jO5A0o4dNA76slL7knB8KgGmJlHcvBPPTikFIcryTkG3797JciFPx2 vJmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eyLIN6Q1SMIB6b4nnie6sq5bML3jn9xhnzCj1TgS3pQ=; b=tA4g91399dVIB2sQyWHN3os5OvelJIb5pArM14epsQOTxdl4UKhjjTtlGvLCfDhlzz roOVg/Sj6LAjxuCENz97xHrpXHYNSsfT8CBskZqqFZj2u4ghu6TbO+qWkiNlCr3HbeX0 DvC5CILfuebwGRhxPb89lCJ5eyjTkCkZN5M3my4ZOqVavvbbmIQSPlLaGR7MWR/qJJrc YcEn9EAeVUScSykjdo+rdpoT5xSaX+rI8YuzXqYLEFD6xvDWE8nqVFgrKgakvl3gS6l0 /S/0S3fKzPhK8Jmx5l3shDnQKsrkffmWsJK1UMnZWRGZEo8x21PeulsPoP6mis+AoE6Z GOpg== X-Gm-Message-State: AOAM533OzaDcq/5s+G/JxrOHC0Or8NI7BxflF53sNh/3Y5W4D61JMYBE 1Y9hy6G8mSxIGeI1t43rA8ZVroEZnQVrTd6QPQ== X-Google-Smtp-Source: ABdhPJznzJPha2w2wDjClqeRDWfiJiwGqKXmqsbYRFUfwWXSJ3RvIUDRzLrjxDgdSII97MaJGQRAlyba6gX7Xv3/foU= X-Received: by 2002:a2e:871a:: with SMTP id m26mr3407989lji.263.1632138863059; Mon, 20 Sep 2021 04:54:23 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Mon, 20 Sep 2021 13:54:12 +0200 Message-ID: To: tyson andre Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary="0000000000002826bf05cc6bf1fe" Subject: Re: [PHP-DEV] Proposal: Adding an ARRAY_FILTER_REINDEX flag to array_values From: guilliam.xavier@gmail.com (Guilliam Xavier) --0000000000002826bf05cc6bf1fe Content-Type: text/plain; charset="UTF-8" On Sun, Sep 19, 2021 at 3:11 PM tyson andre wrote: > Hi internals, > > Currently, array_filter will always return the original keys. > This often requires an additional wrapping call of > array_values(array_filter(...)) to reindex the keys and return a list. > (or applications may not realize there will be gaps in the keys until it > causes a bug or unexpected JSON encoding, etc.) > Hi, This "issue" is not limited to array_filter(), there's also array_unique() and even array_diff()/array_intersect() whose variadic signature doesn't allow to add a flag (I think?)... PS: and array_column() has the opposite issue... -- Guilliam Xavier --0000000000002826bf05cc6bf1fe--