3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $callable; public function __construct() { $this->callable = 'get_class'; } public function yesItDoes() { try { $this->callable->call($this); } catch (Error $e) { call_user_func($this->callable); } } } (new Foo)->yesItDoes();
Output for 8.3.0 - 8.3.7
Deprecated: Calling get_class() without arguments is deprecated in /in/tZR7o on line 15
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19
Output for 5.6.0 - 5.6.38
Fatal error: Call to a member function call() on string in /in/tZR7o on line 13
Process exited with code 255.
Output for 5.5.0 - 5.5.38
Fatal error: Call to a member function call() on a non-object in /in/tZR7o on line 13
Process exited with code 255.

preferences:
192.44 ms | 401 KiB | 295 Q