3v4l.org

run code in 300+ PHP versions simultaneously
<?php class TypedInt { public static int $intVar = 0; } $intVar = &TypedInt::$intVar; echo $intVar; // 0 $intVar = 3; echo $intVar; // 3 $intVar = 'x'; // Fatal error: Uncaught TypeError
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
03 Fatal error: Uncaught TypeError: Cannot assign string to reference held by property TypedInt::$intVar of type int in /in/GFNgp:13 Stack trace: #0 {main} thrown in /in/GFNgp on line 13
Process exited with code 255.

preferences:
112.59 ms | 402 KiB | 90 Q