3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function encodeUrlParam(string $string): string { echo $string; } } class extendedA extends A { public function encodeUrlParam($string) { echo $string; } } $a = new extendedA(); $a->encodeUrlParam('test');
Output for 7.4.0 - 7.4.21, 8.0.0 - 8.0.8
Fatal error: Declaration of extendedA::encodeUrlParam($string) must be compatible with A::encodeUrlParam(string $string): string in /in/ti9uU on line 13
Process exited with code 255.
Output for 7.3.0 - 7.3.29
Fatal error: Declaration of extendedA::encodeUrlParam($string) must be compatible with A::encodeUrlParam(string $string): string in /in/ti9uU on line 17
Process exited with code 255.

preferences:
169.19 ms | 1001 KiB | 7 Q