3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface Itesti { public function hello(); } class testi { public function test(Itesti $temp) { $temp->hello(); } } $temp = new testi(); $temp->test(new class implements Itesti{ public function hello() { throw new Exception("NOOOOU"); } });
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Exception: NOOOOU in /in/k9MHZ:19 Stack trace: #0 /in/k9MHZ(10): Itesti@anonymous->hello() #1 /in/k9MHZ(17): testi->test(Object(Itesti@anonymous)) #2 {main} thrown in /in/k9MHZ on line 19
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught Exception: NOOOOU in /in/k9MHZ:19 Stack trace: #0 /in/k9MHZ(10): class@anonymous->hello() #1 /in/k9MHZ(17): testi->test(Object(class@anonymous)) #2 {main} thrown in /in/k9MHZ on line 19
Process exited with code 255.
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Parse error: syntax error, unexpected 'class' (T_CLASS) in /in/k9MHZ on line 17
Process exited with code 255.

preferences:
187.75 ms | 402 KiB | 228 Q