Thanks to visit codestin.com
Credit goes to 3v4l.org

3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Boo {} class Foo { public function work(Boo $m) { } } $f = new Foo(); set_error_handler(function ($errno, $errstr) { throw new InvalidArgumentException($errstr); }); try { $f->work(1); restore_error_handler(); } catch (Exception $e) { restore_error_handler(); throw $e; }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.24, 8.4.1 - 8.4.11
Fatal error: Uncaught TypeError: Foo::work(): Argument #1 ($m) must be of type Boo, int given, called in /in/VZhkg on line 17 and defined in /in/VZhkg:6 Stack trace: #0 /in/VZhkg(17): Foo->work(1) #1 {main} thrown in /in/VZhkg on line 6
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught TypeError: Argument 1 passed to Foo::work() must be an instance of Boo, int given, called in /in/VZhkg on line 17 and defined in /in/VZhkg:6 Stack trace: #0 /in/VZhkg(17): Foo->work(1) #1 {main} thrown in /in/VZhkg on line 6
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33
Fatal error: Uncaught TypeError: Argument 1 passed to Foo::work() must be an instance of Boo, integer given, called in /in/VZhkg on line 17 and defined in /in/VZhkg:6 Stack trace: #0 /in/VZhkg(17): Foo->work(1) #1 {main} thrown in /in/VZhkg on line 6
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Argument 1 passed to Foo::work() must be an instance of Boo, integer given, called in /in/VZhkg on line 17 and defined' in /in/VZhkg:14 Stack trace: #0 /in/VZhkg(6): {closure}(4096, 'Argument 1 pass...', '/in/VZhkg', 6, Array) #1 /in/VZhkg(17): Foo->work(1) #2 {main} thrown in /in/VZhkg on line 14
Process exited with code 255.

preferences:
144.14 ms | 415 KiB | 5 Q