3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A{ function __construct( protected readonly string $id ){} function dumb():string{ echo strtoupper($this->id); } } class B extends A{ function __construct( protected readonly int $id ){} }
Output for 8.2.0 - 8.2.28, 8.3.0 - 8.3.19, 8.4.1 - 8.4.5
Fatal error: Type of B::$id must be string (as in class A) in /in/77DY2 on line 13
Process exited with code 255.

preferences:
159.06 ms | 998 KiB | 7 Q