Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130153 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 B9DEE1A00BC for ; Tue, 24 Feb 2026 11:36:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1771932974; bh=PtRue8gEfwIsFfjvPSI819FlsTkTQYJSCz5NN39hw1s=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=hqGRgAZzE0+3WULRk49hT4ul1OOoddSpHA7JLruFmUndVaeD3mgVHi+gpBvktxS5m 89R7DwAqjvI2eUYfe+eEpFSR7s+noaOYfKiDRIxidZ3N1KyCOqyZFzDuRdllSX1ce4 cwI4/WPvzRKPPRoV1uHOWJyJkJvbUhh2Ida4TogASyI9TJWWtM6PgSZAPAfDOZpHXj +FWe8r9sM+bEMieU2+0NNDdfMtxVVv/Z6wSJEdWRMGmO8nqM/2AND9E+y29NT/Zehx n5RJvyUEcaxOGuVWmFJtBMG9ctc6yuysruj08//yGPZv+kM7RMQSTFQhfZjaK61hm6 gCXQoN7OWbKyg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9980E18020B for ; Tue, 24 Feb 2026 11:36:10 +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=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (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, 24 Feb 2026 11:36:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1771932959; bh=gWkMy4lwQEDVl6ztUjB1I+ACXy0h/nLKQXC260bvld4=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=TSjbXfwGKTDv4eJp9Mykxgxm9D++I6cQPio9l44lMr9kBcJKPdDKwP1QXFzU1Q+Hu A9CLNFROQttSb6fKzmF3SxlGrGge3lK/moYukZL0nPKRzQ0gBSWPn4N8X8RYPsdM6t cJupOywGNK/FsdTB4efPIPDz63uSxsYZGsFiKBOVVA468ZhtqOjN8c8u2ea0CXk+N+ Sziu1lrMNF8JEUbKB7ISdy/NdCG8la+wT0kninsJ5zRQTec6AgIadQFWvINDV5tfGl dYhBL8jZYVoFDpgyWs433diGmPuKcicvokEXG6YEfcSdPF3Ha4VyDrhQc5lGciatfF KtzXH+7nirxuw== Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Date: Tue, 24 Feb 2026 12:35:58 +0100 To: Ben Ramsey Cc: internals@lists.php.net Subject: Re: [PHP-DEV] [RFC] Readonly Variables In-Reply-To: <20260224004547.C3CD51A00BD@lists.php.net> References: <20260224004547.C3CD51A00BD@lists.php.net> Message-ID: <612d36a742485a793878fed237c7b17f@bastelstu.be> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi Am 2026-02-24 01:45, schrieb Ben Ramsey: > Objects are references, whether or not using the `&` operator. This is false. Quoting from the PHP documentation at https://www.php.net/manual/en/language.oop5.references.php: > One of the key-points of PHP OOP that is often mentioned is that > "objects are passed by references by default". This is not completely > true. […] In PHP, an object variable […] contains an object identifier > which allows object accessors to find the actual object. - > Is the idea to allow objects (and arrays) similar to how JavaScript > handles these with `const`? That is, the objects and arrays themselves > are mutable, but the variable name cannot be reassigned to a new object > or array? The proposed semantics in the RFC are very clearly modeled after the existing behavior of `readonly` properties in PHP: Immutability of identity, which would be “cannot be reassigned”. I'd like to note here that arrays in PHP are values, thus they are immutable when stored in a readonly property (see https://3v4l.org/vS0ij). I expect the same from this RFC, but having array-semantics spelled out explicitly + an example certainly makes sense for clarity. Best regards Tim Düsterhus