3v4l.org

run code in 300+ PHP versions simultaneously
l<?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() { var_dump(get_called_class()); 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; }));
Output for git.master, git.master_jit, rfc.property-hooks
l Fatal error: Uncaught Error: get_called_class() must be called from within a class in /in/NPJ8p:36 Stack trace: #0 /in/NPJ8p(39): {closure}() #1 {main} thrown in /in/NPJ8p on line 36
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
39.77 ms | 401 KiB | 8 Q