3v4l.org

run code in 500+ PHP versions simultaneously
<?php interface interface1 { public function myMethod1(string $param1, int $param2); public function myMethod2(int $param1); } interface interface2 { public function myMethod1(int $param1, string $param2, float $param3); public function myMethod2(float $param1); } class SomeClass implements interface1, interface2 { public function myMethod1(array $param1) { echo "In method2"; var_dump($param1); } public function myMethod2( array $param1, array $param2, array $param3) { echo "In Method2"; var_dump($param1); } } $c = new SomeClass(); $c->myMethod1(); $c->myMethod2();
Output for 8.5.0 - 8.5.3
Fatal error: Declaration of SomeClass::myMethod1(array $param1) must be compatible with interface1::myMethod1(string $param1, int $param2) in /in/N1T30 on line 14 Stack trace: #0 {main}
Process exited with code 255.
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 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: Declaration of SomeClass::myMethod1(array $param1) must be compatible with interface1::myMethod1(string $param1, int $param2) in /in/N1T30 on line 14
Process exited with code 255.

preferences:
86.71 ms | 1267 KiB | 4 Q