Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121403 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 87494 invoked from network); 18 Oct 2023 15:53:09 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Oct 2023 15:53:09 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DAD7D1804C1 for ; Wed, 18 Oct 2023 08:53:08 -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, T_SCC_BODY_TEXT_LINE 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-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 18 Oct 2023 08:53:08 -0700 (PDT) Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2c4fdf94666so77802861fa.2 for ; Wed, 18 Oct 2023 08:53:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697644387; x=1698249187; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=UBSXxy7l/9XVaqk8z+RjvixAz0F7gDL4a8uJbXDGMos=; b=OkuJXe88lJf8KTmTbiv2mEMqsDKZruJ6CHJJFHiES+HDDDdiZrMrUOZefeBaZz+ZuO B6izh2OWEQ+mN+c2X0Gmyl2p5wtjnZM+UP8mKVagtVVuW/ZGHwMiwLKVIsHaWvOqfgM6 VZgp34GRvw4e+EBnQrIc3w9ISKz5wWR9uQdxySg5RaNJ4TtdHjCcx5W37SX7LdBH7VEs PVnm+GY+Q+6BhHUdxJUDntAwOjqwBSw7AuNf/s2ROL4PLgFpBUqMyrOJKpLp9ig0w0f/ LgJMry4JRKEnO+rxkN4GbQpxBjd//2ozjsbdofxORsJWoyXbj8CMT9dZiFJg/nsjxGbU 9H9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697644387; x=1698249187; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=UBSXxy7l/9XVaqk8z+RjvixAz0F7gDL4a8uJbXDGMos=; b=lZ23/wHhgybqCwFfnGY8SOObz+LFrD+M0INLPbqZQAq//stq/4UO69dxqKWhQCDali 1WcmYZktcjWQdP60Xj0H+rqdXNfl5308/KjoRUk35ZXgNM1M+40iumdsIW9OF7L6avSB Ed/419ZYVHJHJCq8pN2VH4Vk/99s5R0x8yrn1LYUDzj8ps56d33p17+/AXuVO/SykXDM YW28QdVAbSiayQvLWBgWf/E2kkiUdm7uYZ083kCNE/5cFkBuIIcBzrQxD+05XUNY3zsG 9nnz+MbVUuC/PbOPnHJ9gFBgHGebF3Ct9Vmm0m0vsRHTrmb0ejSUbXbckAQFjO2ygTt6 iHmA== X-Gm-Message-State: AOJu0Yy95ft3OOuZ0c9GEZu0Zcb62LUlSjexc9lo4j5TFLRt6tIw9pj8 Ch//lReu0tMCOnBeaQUoQa7rGN5cu1QiJPowHXs= X-Google-Smtp-Source: AGHT+IGReV9llQAt6QMShv0X9atL1wp09lVng0JZg+ksNzvATZdQjaWkGLO+DFw4cDIO5iR3YNXCekje/zq9wbob/lA= X-Received: by 2002:a2e:9c09:0:b0:2c5:19ab:7270 with SMTP id s9-20020a2e9c09000000b002c519ab7270mr3919494lji.35.1697644386540; Wed, 18 Oct 2023 08:53:06 -0700 (PDT) MIME-Version: 1.0 References: <173ca550-71a0-4bd4-96f2-b64b6155115a@app.fastmail.com> In-Reply-To: Date: Wed, 18 Oct 2023 17:52:55 +0200 Message-ID: To: Levi Morrison Cc: Robert Landers , Deleu , Brandon Jackson , Saki Takamachi , Levi Morrison via internals Content-Type: multipart/alternative; boundary="0000000000009d61840607ffa2a8" Subject: Re: [PHP-DEV] Two new functions array_first() and array_last() From: benjamin.morel@gmail.com (Benjamin Morel) --0000000000009d61840607ffa2a8 Content-Type: text/plain; charset="UTF-8" On Wed, 18 Oct 2023 at 17:47, Levi Morrison wrote: > > I don't see how `array_is_list` is relevant to `array_first` and > `array_last`. PHP arrays are ordered: > > $foo = [ > "first" => 1, > "third" => 3, > ]; > > It would be perfectly fine to use `array_first` or `array_last` with > `$foo`. I think probably you would use `array_key_first` and > `array_key_last` so you also get the key and not just the value, but I > don't see any need to reduce `array_first` and `array_last` to only be > logical or correct with arrays that uphold `array_is_list`. > I didn't mean that array_first/last should only work on lists; they should work on any array as you mentioned. I was just correcting a statement about lists. Sorry if I wasn't clear. - Benjamin --0000000000009d61840607ffa2a8--