Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127947 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 AE4531A00BC for ; Mon, 7 Jul 2025 17:55:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1751910792; bh=SWJ0tXfIvkFylHYkwQeqmk0hYMmwSnggQF4GSbnnnbY=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=SXzEFzD+PUaMPe+EL5/uktXdMgCxXJhPWPFJT6btKVN5/WNCSB96vjOH7HPjV+yF9 TDIfFSIIt7fvOt27K6+XQzgfePyF/xJJyVNoqUFvz/skXsUqeXj1+N2aWQPPg1/Zoh ubrQ7agBRfQknwF8Igve8/xSQMcA1nJvLGDZZpfYUJgzReHzX1YqrcAuPDjC/xbW4J eizwcf+MiwXlE0ceuLREJVDU0C4csyX8CRWMeKNtCg2b2WmOYaUep24S+DMLsJ09wT rhVwwopq7BHEMn285/V3nMpUiKrItPmTdbebdBLHKNR7t1qUn2BygtXz9P28DK2SG6 g4Gbtka7/GdBw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DEEE11801E9 for ; Mon, 7 Jul 2025 17:53:11 +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.4 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, 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: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (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 ; Mon, 7 Jul 2025 17:53:11 +0000 (UTC) Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4537deebb01so20027665e9.0 for ; Mon, 07 Jul 2025 10:55:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751910901; x=1752515701; darn=lists.php.net; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=osOTJW2zYoHX1AbPMZuTugLBypacwm89IPrgd92tBxE=; b=DtFtnDpd471F/d1F2WSSYGNzkCHWgui7/5KjLqKx41tDW6JwFXRWIwEETh7BJAXaFb E373pWFisS47caxhvcB4gTWAWqa5ypkPs8iX+K2oMt8w5trO2+QXpvYqBWTzTQzdbvyY esGETV6yvw538ODAg6Zl7kWZMWJx0OzXjFX27QSDKfWBmdc2J5Fbqm6/emHEWWrvSU6p qxOX3i0LjIixonttOy94lH2/QgxQ86agMRZgROw7ko4UINj+HGJJWn3ou03GA5hzcNri xPMeLS2RcEBz+LplG0dt+EJfg7FZguIiMPzMX3s+mZlTITfh+g8SKsJu3CaE3fSiVue3 cuQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751910901; x=1752515701; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=osOTJW2zYoHX1AbPMZuTugLBypacwm89IPrgd92tBxE=; b=hZnxQ1I4kUYJfy6fWXIdbn8xPS/WHSQHy8zw/vdA0S79js2ZA0UZc6skmlm3wRLrC0 9Rib3h+po+MFuZ7ZAeCKNR+TW2+OiwHMI3czvnKQxjJxaFql6Hraiv6WojgANabkSWKw srV5g8H3/c3fK+0cNFSK2x2IKNjidw+JBb9uzXRlqmsvkP4kWia+Hyb+0HD/CZDMAHRi qSgVwW+4mR2wq92EVXLhbwjN9BwOVVNzoROjd33YnlCGWTx+35FSTeFFruOuQX/n6D5F TNtXDc4IZBY3htMT+K0N6oruoZTHd6R9or7D5+duD4Zd9JtRCtPIn+M6knZHwYGIJ+tx oEiQ== X-Gm-Message-State: AOJu0YyDKYdShRs4Q/kM8lkrP2np9W9X9crne1su3xTJQCEKSOZiQ+cv BUPzfZiSMq+TKc19DmoS2BsC1R/8/0AtpokIGYFvseX+andvhWMn7/zchkgT/A== X-Gm-Gg: ASbGncukv8ErQMpmoeFPi/6mLdnhh9BmNU8tmQFo9XU8bKNeIAjHSQUnXG/LvvaNsJX x8n7kSspSDPZY1m6hK0mxgcqh7IWxe1uzbnKH5mnQFUJ6OLybomcnXyo7GzJVbeGjvpZ7wotlrD z+mNKI6QCS1xn+7O5ySkEAbN/9V3RfuYk6QbjjfSkLbQseDnpqzx8CkaPFJmxx1f4MHlKChU+R4 9rDv2MV8OksjA1YAmf/LN7nEHG3xSh3xrYQ+kXAdAI1p00eWqfXQzy/ufcyjFwWzWKciNQ9qIVA dcROBPaFCnGlxpPAJRNZrQ7KduwG/7tdh196GX8gt/2GiERM65y38baqGMXhkCFOTZdMc+WHrJ0 6fJ3qanN7eg== X-Google-Smtp-Source: AGHT+IG7p+09Te5gbQMfQG/NhEJPdWk/t6VvgU7xSiYVLr+rnJJN0tPAVDFuw5dGlACh1miI3d32Vw== X-Received: by 2002:a05:600c:8214:b0:450:d568:909b with SMTP id 5b1f17b1804b1-454b4e74957mr127586475e9.14.1751910900883; Mon, 07 Jul 2025 10:55:00 -0700 (PDT) Received: from smtpclient.apple ([89.249.45.14]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-454a997b1ecsm149887085e9.11.2025.07.07.10.55.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Jul 2025 10:55:00 -0700 (PDT) Message-ID: <690F164A-48F3-42B8-A3B6-3CECC3367B24@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_AF175F0D-EA92-4E24-87B0-C425AC9A4DCE" Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.600.51.1.1\)) Subject: Re: [PHP-DEV] [Discussion][RFC Idea] Cast Variables by Reference Date: Mon, 7 Jul 2025 19:54:49 +0200 In-Reply-To: <9f14ae52-6c78-41a1-8d2a-7330fd92d1a9@app.fastmail.com> Cc: PHP Internals To: Joseph Leedy References: <9f14ae52-6c78-41a1-8d2a-7330fd92d1a9@app.fastmail.com> X-Mailer: Apple Mail (2.3826.600.51.1.1) From: claude.pache@gmail.com (Claude Pache) --Apple-Mail=_AF175F0D-EA92-4E24-87B0-C425AC9A4DCE Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Le 7 juil. 2025 =C3=A0 18:22, Joseph Leedy = a =C3=A9crit : >=20 > Hello, I'm Joseph, or Seph for short. I'm a long time listener, but a=20= > first-time caller. I've had an idea rattling around in my noggin for a = while=20 > that I'd like your feedback on: >=20 > As a developer, I would like to have variables of one type cast to = another=20 > type automatically so that I do not need to assign the variable to = itself. >=20 > Instead of the following: >=20 > ```php > $price =3D '5.0123'; > ... > $price =3D (float) $price; >=20 > var_dump($price); // Result: `float: 5.0123` > ``` >=20 > What if we could do this instead? >=20 > ```php > $price =3D '5.0123'; > ... > (float) $price; >=20 > var_dump($price); // Result: `float: 5.0123` > ``` >=20 > If everyone thinks this a good idea, I would be willing to put = together an=20 > RFC and work on the implementation myself, with guidance from an = experienced=20 > core developer. I have no experience with C/C++, other than a brief = foray=20 > more than twenty years ago, but I am willing to learn. >=20 > Thank you for your consideration! Also, a huge thank you to everyone = who=20 > has made PHP what it is today!=20 >=20 > (**Note**: No AI was used in the writing of this message.) Hi, There is already a built-in function for that very purpose, namely = `settype()`, see: https://www.php.net/settype =E2=80=94Claude --Apple-Mail=_AF175F0D-EA92-4E24-87B0-C425AC9A4DCE Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

Le 7 juil. 2025 =C3=A0 18:22, Joseph Leedy = <joseph+php@josephleedy.dev> a =C3=A9crit :

Hello, I'm Joseph, or Seph = for short. I'm a long time listener, but a
first-time caller. I've = had an idea rattling around in my noggin for a while
that I'd like = your feedback on:

As a developer, I would like to have variables = of one type cast to another
type automatically so that I do not need = to assign the variable to itself.

Instead of the = following:

```php
$price =3D '5.0123';
...
$price =3D = (float) $price;

var_dump($price); // Result: `float: = 5.0123`
```

What if we could do this = instead?

```php
$price =3D '5.0123';
...
(float) = $price;

var_dump($price); // Result: `float: = 5.0123`
```

If everyone thinks this a good idea, I would be = willing to put together an
RFC and work on the implementation = myself, with guidance from an experienced
core developer. I have no = experience with C/C++, other than a brief foray
more than twenty = years ago, but I am willing to learn.

Thank you for your = consideration! Also, a huge thank you to everyone who
has made PHP = what it is today!

(**Note**: No AI was used in the writing of = this = message.)

Hi,

There is already a built-in function for that very purpose, = namely `settype()`, see:

=


=E2=80=94Claude





= --Apple-Mail=_AF175F0D-EA92-4E24-87B0-C425AC9A4DCE--