Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116581 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 14833 invoked from network); 7 Dec 2021 02:01:19 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Dec 2021 02:01:19 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D14581804A8 for ; Mon, 6 Dec 2021 19:01:24 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_20,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) (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, 6 Dec 2021 19:01:24 -0800 (PST) Received: by mail-qt1-f182.google.com with SMTP id f20so12979092qtb.4 for ; Mon, 06 Dec 2021 19:01:24 -0800 (PST) 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=obJgp8ZtTshqCdJXZVsHGEQQr1MiJoKzs8Ihv5iEaT8=; b=EStfELp+YBliaOUZxaoeCH2hRap6RGoSrO23UKleGr3WVixsoNfGIx3701jOvoYl5E IgrcwKXL0T/hk6KF0cF1qVaQ9d1sHiEe3zBgDlX08ISb+gofJnT0lSFJfN2Y6E4OP0Na lAGskxI8XinMtvj1H4P27kUxAa3XwV8hOJv2GS/1h3pBhCmQmOaiAAx4bWu+D1TOngKa FvqUtTW+947ttqNJ2c7/yT4zffKE80mfuBVJ6VDkxS7h6nlwH4cwZA3jwW8iYACFsAZE 52xDIZumdCnHZZDBJT8hb6QyHShNqv33DJmNVzrWNmH40DoaeXSQzmyJyGLoxB0f4VOE B36A== 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=obJgp8ZtTshqCdJXZVsHGEQQr1MiJoKzs8Ihv5iEaT8=; b=aISLlmikJDKkKA5OxT6l33A7y2EzJj4W9o13XSe27Ru5fhz4j0DYvN2A+K1usqWDru E8Agf2cvvIytHyQMH+xvP0VHCzovaxVk50TwQ6g+xKfVOHuj6jV4YIkWur/Tg7eI8EJJ MOSAw7dJGaOUL3Q1eO3ccdnTe3HLkaATyqzrba6dXEsZPV9QnOQl6gqrbptAcMZo4YuI ChpJSIkZvRC8UiRHLBRYZlZ/UPlF3n1Urea6dSLiHfqTwqyAK0SxE2y5eWKnjhCJUhET OstaIGrD3I/hyIym/rNBTZvTMXmqTYp/vt/wo6nieVkIwJAHL0a5c/nHQ//4qlg7Oqzg 0qnA== X-Gm-Message-State: AOAM5338wQ8XZ2XwnNxiL1ah8x8ZqsvbNAPWjRp7oGFSywzU1uAVWciu O6UD3Lde9/tPhpoX9C18sBMyMzzzixxDcTB7xAVj+m7IFrlUzQ== X-Google-Smtp-Source: ABdhPJxWo96gEZ1KuumVQXONDtgbZytr0nhFpzsnwhunJGr7JOvFYAxhxTDDmQaV5IIJ7IPCkDsxoTwYYY6097rQmvo= X-Received: by 2002:a05:622a:1102:: with SMTP id e2mr45191784qty.194.1638846083660; Mon, 06 Dec 2021 19:01:23 -0800 (PST) MIME-Version: 1.0 References: <61ac9759.1c69fb81.b0241.1e6fSMTPIN_ADDED_MISSING@mx.google.com> <268F5B4F-4770-48AA-B212-DE23116BCF4C@gmail.com> <2e4dd298-77a1-4c40-ba31-1c9b7ebe1bb1@www.fastmail.com> In-Reply-To: <2e4dd298-77a1-4c40-ba31-1c9b7ebe1bb1@www.fastmail.com> Date: Tue, 7 Dec 2021 10:01:12 +0700 Message-ID: To: Larry Garfield Cc: php internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] RFC [Discussion] array_column results grouping From: the.liquid.metal@gmail.com (Hendra Gunawan) > > Better map/filter/reduce primitives in PHP would be dandy, but they have > nothing to do with array grouping. They're a separate operation that should > be composed with grouping. Packing them all into a single function sounds > like a terrible idea. > > If we wanted that... that's called list comprehensions, which I would > support and even tried to rally support for a few years ago, but got met > with a big shrug. :-) `array_group` is just a simple handy tool which can manipulate a bunch of data without touching SQL, DQL, query builder, or any producer anymore just to align the output to the need. Of course we can code with whatever programming paradigm or style we want, especially if the algorithm is much more complex. Here, i offer you the very basic functionality and without external library. So my coworker does not have to dig into that library, or ask me. The original proposal is to offer grouping, and may be to avoid `foreach`. I think if the only purpose is to group an array, it is halfly baked function- ality. Previously, I had shown you that `foreach` is not too bad to use. Otherwise, I will suggest to the author don't bother with new function, you're wasting your time. With that original proposed functionality, We have to use an additional `foreach` or function call even though it is a basic operation. Moreover, the original purpose is preserved, if we do not give any optional params.