Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127173 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id A39EF1B08C7 for ; Tue, 22 Apr 2025 20:50:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1745354912; bh=A/nLr+BEwf+1WS71tFZF3L81gxpCFhpQOoYGzGUc/Fs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=F9WWThE2J0lFcztHaazMOK8bO6Zmz6okarFuIMI8BZw0NNEp/t3TY4pf6SZ1Ukx+I 7kfjbJdvnaMUO64PJfQ3MyxLKm39C9o8F4EqvMVb3b6vcnaIs2P+5vW5jSvi/kSI4+ cKQKUZV8A7N5sXLhK0wBmpTZIQilpqtc/jU3djczVngwEYR7926I1fFO/JjOXVSqmE 4AZIKrUByCAi3tGZezzjuSF9wn+2/P+YtScEmmO4RHqqWoLYNdBclee44xp4B+jAiQ rJGmzkPoJsQEJTc7KPga53qmCHFaZh474CVGpnVJVEanMjv3+gaCf3vWTzNivGyP0G HkY3ndVXKSfNQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 970831801DC for ; Tue, 22 Apr 2025 20:48:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: ** X-Spam-Status: No, score=2.2 required=5.0 tests=BAYES_50,DATE_IN_PAST_03_06, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 22 Apr 2025 20:48:28 +0000 (UTC) Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-acae7e7587dso758938966b.2 for ; Tue, 22 Apr 2025 13:50:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; t=1745355046; x=1745959846; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=A/nLr+BEwf+1WS71tFZF3L81gxpCFhpQOoYGzGUc/Fs=; b=FInkFGA6W2ymz3i2np8CRfv1aTNOw4Dx7IndevWz89kL/6gHtdm50relPQsXvFxd13 fNg2UeHjy3Mm2BE4hatDQV5u2JpbgIoMYttaM0p3bILy/yowbtxGPc1OSIzsD6tsxCQM FpIHRerWXPz2g5FQ0xftXTxGNO0uHEoon97A4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745355046; x=1745959846; h=content-transfer-encoding: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=A/nLr+BEwf+1WS71tFZF3L81gxpCFhpQOoYGzGUc/Fs=; b=V8FAtp6ALDEHvcpjiFQjs+ODatvBJttiUNER+ZSTwFcXsOeMY0L2+dvfz1y5K6OVvc NcNTx3sbmP+KBvNmWFQ6uINKebxZTUeBOSqTtMbobt2408+K/NCJ3gNwXfaltGPTS3Jg Vh4FTQOTRvdwYzj+038SUywZ31lUc63AiL7EZVvrYgmP+Ik/YPI9Iai+AK8xLO9bWyAw 1iuR/seysAAW5A60f1nNM8eeznE1Wt7kajHD6j9ozZQXuB85f9lQS5c7CaeTiOeToMCi srMf0ZC03cbAFtPeD0/3h/fkYtNOyLrh1fgZe7XiBLfmKOIoJ9TPxrnY2ErucjGXZPtu UJFg== X-Gm-Message-State: AOJu0YxOeiADDmV7jBaxKljGsdKE6+TUICp5wSpz3RMXyq9HgdGHjMGd du5CPRJm8OwA3F6wfGBMYeW8OJPWRxdZmgEcVo7Icftpb5jLj0qdN31oIeYeRap3FBL0qQrDzEo OUiSj+eTfUYSh47pIAb2BiTBeH3pfgNRAtnAUuCWh0ei9OiUnqalZiA== X-Gm-Gg: ASbGncsUUG/wfm8BcvglYq+t0wOaNCzrVkn6xBWMZDmiAj2vF+D7/tmo5fjYyNQK1pH hnjixwX/w8wdQegS2OVbz1PDEnf6GxEwIKbhKoBV6Fr4j4o8TzBmP0gailcOMXkEiAhCALN+9tK Go/0WVA5rU0bB4wSU9GSngIg== X-Google-Smtp-Source: AGHT+IHgX0xNnVoHLlnAipVh3YFpvrYdnPQ5GVBjDhDp7zP3oE9wA4XJ0Fx7fYvfYUm+Hxe8xrgvUt2tT8t7BE1C4nY= X-Received: by 2002:a05:6000:2203:b0:39b:330d:9719 with SMTP id ffacd0b85a97d-39efba3cce3mr11763043f8f.17.1745340726329; Tue, 22 Apr 2025 09:52:06 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <51fcec92-b2ae-482e-920f-c6c991b526c5@gmail.com> <4451399e-ea25-4e5a-a0c0-dc2ea92641b9@gmail.com> In-Reply-To: <4451399e-ea25-4e5a-a0c0-dc2ea92641b9@gmail.com> Date: Tue, 22 Apr 2025 10:51:55 -0600 X-Gm-Features: ATxdqUG-XJPu7uBOU_aoFToXa2-8rR_FoKw3rjG392hzKklBq-lfJQuuW0tYUgI Message-ID: Subject: Re: [PHP-DEV] Re: [RFC] [Discussion] array_first() and array_last() To: Niels Dossche Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: levi.morrison@datadoghq.com (Levi Morrison) On Sun, Apr 20, 2025 at 9:30=E2=80=AFAM Niels Dossche wrote: > > On 05/04/2025 17:51, Niels Dossche wrote: > > Hi internals > > > > I'm opening the discussion for the RFC "array_first() and array_last()"= . > > https://wiki.php.net/rfc/array_first_last > > > > Kind regards > > Niels > > > > > Hi > > I'll be putting this to vote on Tuesday 22nd if no one has complaints. > > Kind regards > Niels In the section "Why include this in the engine rather than userland?", there is this comment: > Very fast implementation, faster than a PHP implementation in > my brief tests. Further optimization is possible by > implementing an additional frameless variant, but that's > future material if ever necessary/interesting. I think array_first and array_last are good candidates for being frameless, as they are quite cheap functions, so lowering their overhead further is nice. Additionally, they don't call into user code, so the chance that this function will be included in a stack trace is quite low. These arguments also apply to array_key_first and array_key_last, of course. I don't think it blocks this RFC in any way, and could be made frameless after the vote--I just wanted to bring up that I think they _should_ be frameless if they get accepted (and update array_key_first/array_key_last to be frameless too).