Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121367 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 89179 invoked from network); 18 Oct 2023 02:30:20 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Oct 2023 02:30:20 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CABA31804C1 for ; Tue, 17 Oct 2023 19:30:19 -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,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS9370 160.16.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail.sakiot.com (mail.sakiot.com [160.16.227.216]) (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 ; Tue, 17 Oct 2023 19:30:19 -0700 (PDT) Received: from smtpclient.apple (253.69.239.49.rev.vmobile.jp [49.239.69.253]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.sakiot.com (Postfix) with ESMTPSA id 56893401D4; Wed, 18 Oct 2023 11:30:17 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sakiot.com; s=default; t=1697596217; bh=7jR8sf6XEHpE4YZyullJ6ic8W05wcioc2Cn71rDvDXE=; h=From:Subject:Date:References:Cc:In-Reply-To:To:From; b=lCnA8QZ9lN4ZGvzuse6ukT8Q5d9cJAnVSsHwf23XO62BDwzSbKN0lQSXXbtdZ6vjo CaMaGWvMFsXz+UywAbmf1Hq05FTSuxWfjJSCsuz+AaDpICeRub1JEMq9SpnGB+AAHq dg5Gtn7R7/zPfDY2bjqPoGhan1RwzMXzvbQAN0lw= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) Date: Wed, 18 Oct 2023 11:30:04 +0900 Message-ID: <9B6FD04B-D0EE-4506-B35A-A52D1149A4F2@sakiot.com> References: Cc: Levi Morrison via internals In-Reply-To: To: Brandon Jackson X-Mailer: iPhone Mail (21A360) Subject: Re: [PHP-DEV] Two new functions array_first() and array_last() From: saki@sakiot.com (Saki Takamachi) I thought of it after sending the email, so I'll post it again. By combining= my two ideas, I think I can come up with a smarter proposal. ``` array_first(array $array, int|string &$key =3D null) ``` If you want to accurately determine whether an array is empty or not, you ca= n satisfy your request by checking if the key is null. Users who do not thin= k accurate determination is necessary can omit the second argument. And if you also want a key, it can fulfill that request as well. Regards. Saki=