3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private function __call($name, $args) { echo $name; } private function foo() { echo 'ahoj'; } } class B extends A { public function bar() { echo $this->foo()."\n"; } } $a = new B; $a->bar(); call_user_func(array($a, 'foo')); $ref = new ReflectionMethod($a, '__call'); $ref->invoke($a, 'foo'); //$ref = new ReflectionClass($a); //var_dump($ref->getMethods());
Output for git.master, git.master_jit
Warning: The magic method A::__call() must have public visibility in /in/Sve43 on line 3 foo foo Fatal error: Uncaught ArgumentCountError: Too few arguments to function A::__call(), 1 passed and exactly 2 expected in /in/Sve43:3 Stack trace: #0 [internal function]: A->__call('foo') #1 /in/Sve43(24): ReflectionMethod->invoke(Object(B), 'foo') #2 {main} thrown in /in/Sve43 on line 3
Process exited with code 255.
Output for rfc.property-hooks
Warning: The magic method A::__call() must have public visibility in /in/Sve43 on line 3 foo foo Fatal error: Uncaught ReflectionException: Method B::__call() does not exist in /in/Sve43:23 Stack trace: #0 /in/Sve43(23): ReflectionMethod->__construct(Object(B), '__call') #1 {main} thrown in /in/Sve43 on line 23
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:
47.12 ms | 401 KiB | 8 Q