3v4l.org

run code in 500+ PHP versions simultaneously
<?php // This is fine. class Foo { public $ordinary; public function bar($a) {} // Untyped param. } class FooChild extends Foo { public mixed $ordinary; function bar(mixed $a) {} // Child declares the param as mixed, which is allowed. }
Output for 8.5.0 - 8.5.3
Fatal error: Type of FooChild::$ordinary must be omitted to match the parent definition in class Foo in /in/seDWM on line 9 Stack trace: #0 {main}
Process exited with code 255.
Output for 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18
Fatal error: Type of FooChild::$ordinary must not be defined (as in class Foo) in /in/seDWM on line 9
Process exited with code 255.

preferences:
59.64 ms | 988 KiB | 3 Q