Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121421 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 18461 invoked from network); 18 Oct 2023 18:55:58 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Oct 2023 18:55:58 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3A55E180044 for ; Wed, 18 Oct 2023 11:55:58 -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: AS24940 176.9.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 18 Oct 2023 11:55:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1697655356; bh=+v7HiGJnLlbZYac2S0idAt97Z0Lx36EEI5TWWdY3B0o=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=fyXZEyf7b3yA5Qup4wcrCau9OGXGf1UTo4EP3jyqqcHN4FCrT9Nc3fsv9J5Vnppds sTQE9N+JAe1NMAcWenupFSqD2US9Qbe07/h1TyA6KQtUDVGUHUZEQlzNIZd6DNI/OT 1Gutr2FsQVaYwYKsrR4So/Qt42LiK5FGAnfdiOVXZ95DPOSXkjru9e3nlSMK4vVwcj N4Hq/yDpucMrDy9ZQ/9GrWmP3qLG7+WDy/Nxtw4/wCfpkPp5ximXpyCol4gDAyk5y0 mg53fjIVuaAr9Twe5m/fku8Cf2S7AyrDc6anCFkpJ/Uh60ho8JzlT7ZiNO15mVp2jp cRkQZcZ8+bsrw== Message-ID: Date: Wed, 18 Oct 2023 20:55:54 +0200 MIME-Version: 1.0 Content-Language: en-US To: Saki Takamachi , David Grudl Cc: internals@lists.php.net References: <3006DBD0-411C-4855-A101-9B8861544B61@sakiot.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Two new functions array_first() and array_last() From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi On 10/15/23 05:48, Saki Takamachi wrote: > I came up with the idea of ​​using a signature like array_filter(), and when a callback is passed, "return the first/last element that matches the condition" and "return null if there is no match." This would be 'array_find()' and I would be in favor of it, with the caveat that I would want it to work with arbitrary iterables. See this previous thread regarding that topic: https://externals.io/message/118896#118896 Best regards Tim Düsterhus