Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128680 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 lists.php.net (Postfix) with ESMTPS id C74581A00BC for ; Fri, 12 Sep 2025 10:35:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1757673224; bh=CMmRuVAK5Dk99Bq2vAQhiYQNLOF2FfRirNNHsENX8fk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=OxWlhfRYS2YNL7UuibTNqw9PrcZZuVfqTYHPcu4etCBvwr0Mx4kZt6PJrxF0y57lD GilzXdXgeE2lHKsiBW4JBqqxgFK9bpDJMBUI1/KqJaiCNfXwepnFbEHU8ZnxKPXAqk lkO7psuUdY7REDkTVVp0t3lJswPVjBI4ei0/pC6tCtwVoQenqrzz6e4U9xomcHL+Ug QXJ6CUKxz9FwAHekG74Q82XoI7x32hO1L5A6y+0fxqd6h52n8s3nZt1j9meN+w2llX l8wcFHxs+bXIalWt6SUSJaD3Rh3ktFHlVF/GltX6fqj7VCa27wfNDgN3pVo9IlJmvu aXbw1y7bA1mGQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id AB99A180032 for ; Fri, 12 Sep 2025 10:33:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: * X-Spam-Status: No, score=1.8 required=5.0 tests=BAYES_50,DMARC_NONE, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) (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 ; Fri, 12 Sep 2025 10:33:40 +0000 (UTC) Received: by mail-yb1-f182.google.com with SMTP id 3f1490d57ef6-ea3e7c4aef5so111074276.2 for ; Fri, 12 Sep 2025 03:35:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757673306; x=1758278106; 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=CMmRuVAK5Dk99Bq2vAQhiYQNLOF2FfRirNNHsENX8fk=; b=V00xqLFcfa4o1Orz2tWVE65LDOio5c0VL03rioZIiqAh62U9xYBNx4BDblvf/CU1If jrary0nwlxBycGkyq3//GjhTa/MpjnNrFdseVgs2NGmuoN26Dfr8Pg8+p2uOUdeh/liF I2xEMEQ6ADoTofNQGlkW+rDs/AuiKRWor3l6e7SLkjgpv7+OhX8okWrOzmhkaUuqsgd6 Nb/FlcWo4OqBPct8PSktLVxbPg+UqbAai6kA6id/ARVisRZ8bdComU/RTlDxESwjUCRW JGASwcWPPZl0axC0c5KLSjnTU+Q/Du4KjDPyIvzJrLGjLJnDQ1ED1e2cM3CmZ3joN7y+ tCJw== X-Gm-Message-State: AOJu0YwvUngMGmILIxMw9hsrwekKe0CjNdTJM0AF/JR9M9QP+v246J66 7RWiJBb6QH/Ud4QMn8kUnJZzv4yEre8vUvxjYfO9xO9n3OXoU5QiHS1glA7NJdzoGiBf1qOwls5 tSP+ED9sM63Bh+6XvajFyt1IW6ayB/oE= X-Gm-Gg: ASbGnculQJQyEjQvF2I8+YkkzjXxLMC59yGH5h6S2DfB6NC/c4v/DKOCAjm21RkJCxz eLBCZGFAoeBV+thTv5PiZMzFspabxxam+sTVb2/lsskK3duSry9P0Mmwgp3mlN3sRZXi3c3AXIM YsxPXMHfKCwn1+a0olMumOlrB1fM752eo+hckLiFo5eaZMkj/u9dZKwSiD2tjWHuImv7pS5yt1w Vb+TIwZl9B/XeQFUg== X-Google-Smtp-Source: AGHT+IEG79iVkUX/LB4gZNn1h86Az+du9+crE/o9gYdWtnu4oyfuZuaAfEWmxfxT2Aj+HRxIkYJ/ECLwmA4M26mfoOY= X-Received: by 2002:a05:6902:33ca:b0:e98:a36a:7635 with SMTP id 3f1490d57ef6-ea3d9a2ae45mr2154837276.12.1757673305729; Fri, 12 Sep 2025 03:35:05 -0700 (PDT) Precedence: list list-help: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 12 Sep 2025 11:34:54 +0100 X-Gm-Features: Ac12FXzV-1vVsmAYAZd46NWXMG71AXbDnvgENFxb6YfMhYzc0BdRcMalLfyG5Zs Message-ID: Subject: Re: [PHP-DEV] [RFC proposal] Syntactic sugar for array push() To: =?UTF-8?B?RHXFoWFuIEtyZWhlxL4=?= Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="00000000000004eee4063e983581" From: kguest@php.net (Ken Guest) --00000000000004eee4063e983581 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable But we already have $array[] =3D 1; - are you unaware of it or is there som= e other benefit to what you are suggesting? What might interest people would be a syntactic sugar/shorthand for array_pop but I have no idea what that might look like. On Fri, 12 Sept 2025 at 11:21, Du=C5=A1an Krehe=C4=BE wrote: > A proposal to add syntactic sugar for array_push() in PHP. > > Syntax: > // now > array_push($array, 1); > > // new syntax > $array[+]=3D1; > > Du=C5=A1an Krehe=C4=BE > > --=20 http://about.me/kenguest/ --00000000000004eee4063e983581 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
But we already have $array[] =3D 1; - are you unaware of it or is there some other = benefit to what=C2=A0you are suggesting?

What migh= t interest people would be a syntactic sugar/shorthand for array_pop but I = have no idea what that might look like.

On Fri, = 12 Sept 2025 at 11:21, Du=C5=A1an Krehe=C4=BE <dusankrehel@gmail.com> wrote:
A proposal to add syntactic sugar for arr= ay_push() in PHP.

Syntax:=
// now
array_push($array,= 1);

<= /div>
// new syntax
$array[+]=3D1;

=
Du=C5=A1an Krehe=C4= =BE



--
--00000000000004eee4063e983581--