3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types=1); class First { public function count(): int { return 0; } } class Second extends First { public function count() { return 1; } } $c = new Second(); var_dump($c->count());
Output for 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.36, 8.3.0 - 8.3.5
Fatal error: Declaration of Second::count() must be compatible with First::count(): int in /in/frkqe on line 16
Process exited with code 255.
Output for 7.3.0 - 7.3.31
Fatal error: Declaration of Second::count() must be compatible with First::count(): int in /in/frkqe on line 20
Process exited with code 255.

preferences:
29.97 ms | 1167 KiB | 5 Q