Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127061 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 F27E51A00BC for ; Sun, 6 Apr 2025 17:06:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1743959047; bh=KmvZ+xdkRn2DnWPxTWzTlopdAJ1i9hSYW6xwHD8feic=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XV7j1pxJ4YHaE50FMeel9Sth+/h0Yy2T8n/tMbdwBjN6eBQAG6iQhVGBUWjtsphUZ 9j7DJg+e6FUdfJEKVaTWE4yn+30lcm9X1yU2c114U2HAjl3WF45j//jBF2dvQkV9iI BSKcxLnLRNcNKogT7uhF2yF5S/FuzRcp2yBj6Yjodxnj5vFHvLIWQKXVC/8Q9J8Lod ppr4AJgQlANpxcswA4gyJPYYnzfPxAPGpuY5cXmBeU1MIzMpX6mYPiqbf6RH7xaybb p8dCl34MDHz8qnL/OWXb7ktoBpOIOrpKcOhzbIYRMOcJKC+oc45Gps5zmQTYPnwcH7 BQPL0F9Rs5H5g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 78A7C180072 for ; Sun, 6 Apr 2025 17:04:06 +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=0.6 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_PDS_PRO_TLD autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from dormouse.ash.relay.mailchannels.net (dormouse.ash.relay.mailchannels.net [23.83.222.50]) (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 ; Sun, 6 Apr 2025 17:04:05 +0000 (UTC) X-Sender-Id: yszpovajlk|x-authuser|juris@glaive.pro Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 6FA31844D44; Sun, 6 Apr 2025 17:06:29 +0000 (UTC) Received: from server42.areait.lv (100-102-82-18.trex-nlb.outbound.svc.cluster.local [100.102.82.18]) (Authenticated sender: yszpovajlk) by relay.mailchannels.net (Postfix) with ESMTPA id 3C045844E36; Sun, 6 Apr 2025 17:06:28 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1743959188; a=rsa-sha256; cv=none; b=Yr6XrjuyztdvMOFVGZk7vZ9GklVw1B9yxu967xsgvTuQvHbjuVuX0+rLv3ZX3xLAt+JD4+ viJG1ltEAU//50DrKWNBphQT5mAvC9XjcEnAe6M7J1tfIc985ZBEhNfj0kG4eh/dHK/+G+ 2htJOAHV+3a8bBIbx20ks37cnG8PbhETsiMmU857ODBAY7lLUZJYIZ/D5MVNQQlZJTUrrC xi/pNZyB3PmwWLX4g/n9YXoW/Ri88UUA9aRV/7fLRUUixGtvXCO8syh2uMuc4VQWQZ3rxm dELhdPeD3kITVSbj0lgXpnRaeQy3uCQ0AhFGBZGk2er8YI0/Ao+Fm9dgLvOMxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1743959188; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=fTxM5lVSfm4pMLFYUP57jAhI6mjDXIULDCI7d4h93Yg=; b=bAuyXKszdGnS1gs+0oRXped5206LHub7ODSYB6pSwO1esRAkQsDiR55ce1k7cfpoXsJy9f l8NimWdUbK3cvcV2XYjnooOGux1a8KJ3ErVM1FCNGDS+rX33Q5wYqbIdWxLyWKxf5plNex 4M0+ZoZadfA4XcUeNmtTe19RGYxD/uuMv1cMoEbZS2UD4xeDYrctDiVzUhYO/WVTVKWXBv b06aCHnWndhH4iKzty5wkZbmjOFiLpkjUw04E1+TwbkWuR7psERKsDwjIhjVYgiGSb8j0F 32ZwGQ3vCm1GYXJr6NnUdOgx5emdD0kEwLvrONpKq2VA5Mst39kH8oRGxmRuVg== ARC-Authentication-Results: i=1; rspamd-7dd6dcd7db-v9t8w; auth=pass smtp.auth=yszpovajlk smtp.mailfrom=juris@glaive.pro X-Sender-Id: yszpovajlk|x-authuser|juris@glaive.pro X-MC-Relay: Neutral X-MailChannels-SenderId: yszpovajlk|x-authuser|juris@glaive.pro X-MailChannels-Auth-Id: yszpovajlk X-Lyrical-Shelf: 61da80b12b614b3c_1743959188913_204724222 X-MC-Loop-Signature: 1743959188913:4247629486 X-MC-Ingress-Time: 1743959188913 Received: from server42.areait.lv (server42.areait.lv [212.7.207.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.102.82.18 (trex/7.0.3); Sun, 06 Apr 2025 17:06:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=glaive.pro; s=default; h=Content-Transfer-Encoding:Content-Type:Message-ID:References: In-Reply-To:Subject:Cc:To:From:Date:MIME-Version:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=fTxM5lVSfm4pMLFYUP57jAhI6mjDXIULDCI7d4h93Yg=; b=WvJxJMx8EIUDb+pzSjpFec9XAT QNnlKQMpjEE0B3SSo/kL3RIBFzL67CzanCaGBqi/DF9QsbhsfzPCHckUJDYcBQvsB4RbHAdZc3CmD 2qNZoUUCxmw2kCHYzCHWzKbF8x0Np2fSPd6rZLvP98nGDsKyk+nesN2U9SjbXjNml19QR48ks+6zd 4ZD4QLe0NhPFowBq+b/tvZDwKxfAZlJLXKoAoRezYgPLB/Jf9kAq8M3JiIhVy3e0ZC81bASkGatE/ qxOUiQP30FF4XlNcBcBMliqNWl8xGf1Xkeb4DIsEEEzeAcaDDOAUk1NPNh9ETt20pUKNiv1S8O6fA +zW8fJgg==; Received: from [::1] (port=47906 helo=glaive.pro) by server42.areait.lv with esmtpa (Exim 4.96.2) (envelope-from ) id 1u1TRx-003ugu-2E; Sun, 06 Apr 2025 20:06:26 +0300 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Sun, 06 Apr 2025 20:06:25 +0300 To: Niels Dossche Cc: PHP internals Subject: Re: [PHP-DEV] [RFC] [Discussion] array_first() and array_last() In-Reply-To: <51fcec92-b2ae-482e-920f-c6c991b526c5@gmail.com> References: <51fcec92-b2ae-482e-920f-c6c991b526c5@gmail.com> User-Agent: Roundcube Webmail/1.4.8 Message-ID: X-Sender: juris@glaive.pro Organization: SIA "Glaive.pro" Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-AuthUser: juris@glaive.pro From: juris@glaive.pro (Juris Evertovskis) On 2025-04-05 18: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, Do you think it would be hard or wrong to add `array_nth`? I've had more trouble with that as the in-place implementation is usually pretty unreadable, e.g. array_slice(array_values($array), $offset, 1)[0] ?? null I understand this need is less common, especially compared to `array_first`. But I also suspect that an in-engine implementation might have more performance gains compared to an userland one. BR, Juris