3v4l.org

run code in 300+ PHP versions simultaneously
<?php function callStatic($class, $method, $args, $ref, $defined, $called) { var_dump($class, $defined, $called); $ref = new \ReflectionMethod($class, $method); $ref->setAccessible(true); return $ref->invokeArgs(null, array($args)); } class n_0d19ad5d1a89cbbf06a49f56e9dcb11d { public static function foo() { return callStatic('static', 'bar', array(), array(), __CLASS__, call_user_func(function () { set_error_handler(function () { }); $called = get_called_class(); restore_error_handler(); return $called; })); } } class n_1c54f3f5b4e9e0fc521faa21fe127ad8 extends n_0d19ad5d1a89cbbf06a49f56e9dcb11d { protected static function bar() { return __CLASS__; } } echo callStatic('n_1c54f3f5b4e9e0fc521faa21fe127ad8', 'foo', array(), array(), __CLASS__, call_user_func(function () { set_error_handler(function () { }); $called = get_called_class(); restore_error_handler(); return $called; }));

preferences:
38.2 ms | 402 KiB | 5 Q