Re: Property Hooks Discussion
| From: | Ilija Tovilo | Date: | Fri, 31 Mar 2023 13:44:02 +0000 |
| Subject: | Re: Property Hooks Discussion | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-119814@lists.php.net to get a copy of this message | ||
On Fri, Mar 31, 2023 at 3:24 PM Larry Garfield <larry@garfieldtech.com> wrote:
>> In other words, will it be possible for this to no longer be true (I'm
>> not sure it is always true now, fwiw):
>>
>> $x = $y = $z = 1;
>>
>> $x === $y && $y === $z;
> That would mean the following as a side effect:
>
> $f = new Foo();
> $val = '5';
> $f->val = $val;
> $f->val === $val; // false, because different types!
Ah, I see now what you meant, Robert. This already doesn't hold.
class Foo {
public int $prop;
}
$foo = new Foo();
$value = '42';
$foo->prop = $value;
var_dump($value === $foo->prop);
// false
Ilija