Re: [PHP-DEV] [Discussion][RFC Idea] Cast Variables by Reference

2025-07-07 Thread Joseph Leedy
On Mon, Jul 7, 2025, at 11:54, Claude Pache wrote: > Hi, > > There is already a built-in function for that very purpose, namely > `settype()`, see: > > https://www.php.net/settype > > > —Claude Thanks, Claude. Over twenty years of PHP development and I didn't know that function exists (or I

Re: [PHP-DEV] [Discussion][RFC Idea] Cast Variables by Reference

2025-07-07 Thread Joseph Leedy
On Mon, Jul 7, 2025, at 10:46, Rob Landers wrote: > This is basically how non-strict mode works; there's no need for a cast. (I > very rarely > use strict mode, so I was a little confused on why you'd ever want to do this) I always code in strict mode, so I find myself having to cast variables qu

Re: [PHP-DEV] [Discussion][RFC Idea] Cast Variables by Reference

2025-07-07 Thread Joseph Leedy
On Mon, Jul 7, 2025, at 10:47, Alexandru Pătrănescu wrote: > > You need to use a slightly different syntax, maybe `(float)&$price;` that is > an error now. Apologies; I missed the ampersand in my example solution.

[PHP-DEV] [Discussion][RFC Idea] Cast Variables by Reference

2025-07-07 Thread Joseph Leedy
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