Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121424 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 29272 invoked from network); 18 Oct 2023 21:11:33 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Oct 2023 21:11:33 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CAE83180543 for ; Wed, 18 Oct 2023 14:11:32 -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=-0.7 required=5.0 tests=BAYES_05,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-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (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 14:11:32 -0700 (PDT) Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2c50305c5c4so91384581fa.1 for ; Wed, 18 Oct 2023 14:11:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697663490; x=1698268290; 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=OFsPdzNEmg9iY1/l+39YU3TRr/s+z6sMWevHghW6FBo=; b=VrFyzw1fROy8uYtzR4Q3pgb15e2zQSVYWh8R88l/3EocD0OgnXXRk0gLnwKYgB7WKk i5WQu/n3m17/QLQvZDzIaIy9gP7OGvceX7HUDXIGgu9wS+69zu8dXi6vciWErA6s/PYw ObMHYmqaIlxGRkTNWkUtKeG4/wvt4RXLEOvagpEIEjK1/wkh2jDrRRTgRr77unDyVpQe ZgLmMRsfUuh4GnGLdEeLmEDXFAZe7shTUHAJelHRsFuLoc+puJNeEHT/7UX7SjZB9AOj PY9CiMgIDNfET+lj/OD78kQ9YlY3QckeLp8UzGL9k2ACHGG/TjM1NHLqZxTEyBhbtuKG UdMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697663490; x=1698268290; 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=OFsPdzNEmg9iY1/l+39YU3TRr/s+z6sMWevHghW6FBo=; b=qz+y2WRppkd0ctwXAGwJ6ZwuiXSBLraoRs0JmCHBcX9L5lKePiz/p6KmmIAkeA2Ha7 f9LIqJi5q8k2jh6Nbh64YzNttfysqAEnL64FkxWTuyA1XgJJEgXH5KHCLt5j2bAVf4a5 61EsLi6vygybARpouyGLk6qTOmkQlIbVadiB6HIFketbITcysNN2bjhzMG34yZ/AElTo 18JQMhG4QhHGAdkxb2RRgZJhrhViXv4EHpdpeeNH5L8VAgDDtTPQgHs6gtulMxqvyVfw 0chDhz5a1YKXsjxHpmURHcmgMZP+w60zbcW7+Ce32PoHZkjfAIct15u51ePXR16wlL7v kKDw== X-Gm-Message-State: AOJu0YzyLecPACUJe5qcIF7sVrZqkZzXGxg3VwZ92JsQ+xxPRdV+Cks+ C8S1FZ4/QOmKxSPEKp6BYFQuRV0AuoH/SAKXphc= X-Google-Smtp-Source: AGHT+IFhl+y8ItBVLm9wJZlz8QHJSDauf203qqa5B3pPJIZgM5E8sBGTiO94MzqiG2NV/xgR80IyPGJ9zobjaZM1joc= X-Received: by 2002:a05:651c:b0b:b0:2c0:17bc:124e with SMTP id b11-20020a05651c0b0b00b002c017bc124emr113069ljr.38.1697663490102; Wed, 18 Oct 2023 14:11:30 -0700 (PDT) MIME-Version: 1.0 References: <173ca550-71a0-4bd4-96f2-b64b6155115a@app.fastmail.com> In-Reply-To: Date: Wed, 18 Oct 2023 23:11:18 +0200 Message-ID: To: Brandon Jackson Cc: Deleu , Levi Morrison via internals Content-Type: multipart/alternative; boundary="0000000000004699a6060804151e" Subject: Re: [PHP-DEV] Two new functions array_first() and array_last() From: jorg.sowa@gmail.com (Jorg Sowa) --0000000000004699a6060804151e Content-Type: text/plain; charset="UTF-8" > Sure in many use cases undefined and null can be equivalent, but there > are other use cases and considering the fact that php does not have a > user level "undefined" value. It should at least attempt to not be > ambiguous when possible. Instead of being ambiguous by default, > requiring the user to do additional work to not be ambiguous. > > I do think the method is a great opportunity to avoid ambiguity, > without a huge sacrifice on cost. As you said, throwing an exception > would only further complicate things. Sure an empty check would get > the job done, but again I believe it should not require such > additional logic just to not be ambiguous. > Can we have ultimately a flag in the function for throwing an exception in case of empty array? Kind regards, Jorg --0000000000004699a6060804151e--