3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C { public ?int $a; public ?string $b; } $c = new C(); $c->a = &$prop; $c->b = &$prop; $prop = '43';
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.27, 8.4.1 - 8.4.14
Fatal error: Uncaught TypeError: Cannot assign string to reference held by property C::$a of type ?int and property C::$b of type ?string, as this would result in an inconsistent type conversion in /in/defVI:11 Stack trace: #0 {main} thrown in /in/defVI on line 11
Process exited with code 255.

preferences:
55.4 ms | 406 KiB | 5 Q