Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119826 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 21346 invoked from network); 6 Apr 2023 13:31:18 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Apr 2023 13:31:18 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0D5571804B3 for ; Thu, 6 Apr 2023 06:31:18 -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,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (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 ; Thu, 6 Apr 2023 06:31:17 -0700 (PDT) Received: by mail-pj1-f43.google.com with SMTP id v9so1224295pjk.0 for ; Thu, 06 Apr 2023 06:31:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680787876; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=caKgGqE+r4eJdTwpViMCNV7AhclHaGyEDSbQyhgY1ew=; b=GWWpfA7Wmn6DzZ6hdOjosKasY67bckuj+1HQz6B3gTImr6V4Rzle1qZnshaHvTcXyj Ubq35KM/ph3RAe9CXB1LO9iSRo7qA637jnNZn/VwV7ByTm4rrMm0Cs2Nr6I8Yyv1ZFL1 nX5tRm79yhBJpVDlZ4gzTIWSpB/NmvpFZUR4V4PPjNON45P281JckfDeev0aDbWgHM+8 NKZjTlADz/6nBaFLc9Eph/nlgpOhW0CgJ5OwqZ8VcXV0j1j8yxC4wYkLK41+tgo3wF+a Z25Iyjx0dC+IMdN/ZvRt7FNK+gX7F84JYxcWnBst6IfJz3AwDeq0A9NPW2yNo1WCkatp w3kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680787876; 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=caKgGqE+r4eJdTwpViMCNV7AhclHaGyEDSbQyhgY1ew=; b=2lP8ciNX4eTln7gkBHvBCOWyldXybSoJD/LABbLpfHyU9bp4Ev+pH6HLJ4Hag0lm+h bk89dnukEJ4P38/OTeT4bG0mEmWVBy/1xByp+rbiZsPyig4LQTBP9SHg22tSFfrxFZJa mmFPvdjO5Z59nNkn761n1S1Jz+NwhVrLbjVsCsYp5iSm4PRCnobKOdRUliiVNaE/nHhh Aq6jW9Jq2rtCS0fKmuyv7yAfTLHhn6NMqlFCXIqlLQTuB9N4zi4uJabB1Zdm8X8vpK3A zPUAhCkEt1zXgmBOmbM/Dl7p3Ve4byGmfof8RPP1X5IeBmotChZLu9jDOED1ADQEeFFa rAxw== X-Gm-Message-State: AAQBX9fmAcQOinmuFpwwOF5Jmg2NfQ9+49oGCQOGb/h+qtIHRQVHSFs5 UWC6dvzzG3VOIvbWQ7MrmjuSYBfe9o6vx7fKm34= X-Google-Smtp-Source: AKy350by1vnJ4jC1Z8olcAz4S4/unScNcAkzpqDp9h4vRHA26E6b/N5GCYCMt5JeH/CgWIHRGIGbKgOala0erXHqnfM= X-Received: by 2002:a17:902:bd07:b0:19f:239a:d80c with SMTP id p7-20020a170902bd0700b0019f239ad80cmr3860200pls.7.1680787875649; Thu, 06 Apr 2023 06:31:15 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 6 Apr 2023 14:31:04 +0100 Message-ID: To: mickmackusa Cc: "Vorisek, Michael" , PHP internals Content-Type: multipart/alternative; boundary="000000000000455d2205f8aaecbd" Subject: Re: [PHP-DEV] Array spread append From: george.banyard@gmail.com ("G. P. B.") --000000000000455d2205f8aaecbd Content-Type: text/plain; charset="UTF-8" On Thu, 6 Apr 2023 at 14:04, mickmackusa wrote: > I think it would be more intuitive to implement an array "appending" > functionality with "concatenating" syntax. The `.=` syntax already exists, > but is forbidden from use on non-strings. If you want to implement this > preexisting syntax as an array concatenation operator, then it is a blank > slate -- you can decree whatever behaviors you wish for it without blurring > what the combined operator does with strings. > This would be the idea situation, but this is not correct. Arrays, still in PHP 8, get automatically cast to strings during concatenation or echo: Results in: Warning: Array to string conversion Warning: Array to string conversion string(10) "ArrayArray" See: https://3v4l.org/26Jba I'm expecting that in PHP 9 this is going to throw a TypeError similarly to how non-string castable objects throw a TypeError in PHP 8. But because this was "only" a notice in PHP 7, this specific change only got promoted to an E_WARNING. Thus, this suggestion is not possible until the major version, but I do prefer this compared to the weird $a[...] syntax. Bbet regards, George P. Banyard --000000000000455d2205f8aaecbd--