3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C { function bar(array $a) {}} class D extends C{ function bar(iterable $a) {}} var_dump(new D); class G { function bar(): iterable {}} class H extends G{ function bar(): array {}} var_dump(new H); class A { function bar(iterable $a) {}} class B extends A{ function bar(array $a) {}} // WAT? var_dump(new B); class E { function bar(): array {}} class F extends E{ function bar(): iterable {}} var_dump(new F);
Output for 7.0.0 - 7.0.12
Warning: Declaration of D::bar(iterable $a) should be compatible with C::bar(array $a) in /in/q7Tfs on line 4 Fatal error: Declaration of H::bar(): array must be compatible with G::bar(): iterable in /in/q7Tfs on line 8
Process exited with code 255.
Output for 5.6.0 - 5.6.27
Strict Standards: Declaration of D::bar() should be compatible with C::bar(array $a) in /in/q7Tfs on line 4 Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/q7Tfs on line 7
Process exited with code 255.

preferences:
155.28 ms | 1399 KiB | 48 Q