3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function save($a = 1, $b = 2) { printf('Class name %s, A = %s, B = %s%s', get_class($this), $a, $b, PHP_EOL); } } class B extends A { public function test() { $closure = Closure::fromCallable('parent::save'); $closure->bindTo($this); $invoker = new Invoker(); $invoker->run($closure, func_get_args()); } } class Invoker { public function run(Closure $closure, array $params) { $closure(...$params); } } $o = new B; $o->test(); $o->test('fff'); $o->test(100, 500); $o->test('a', 'b', 'c');
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Use of "parent" in callables is deprecated in /in/TBRl6 on line 15 Class name B, A = 1, B = 2 Deprecated: Use of "parent" in callables is deprecated in /in/TBRl6 on line 15 Class name B, A = fff, B = 2 Deprecated: Use of "parent" in callables is deprecated in /in/TBRl6 on line 15 Class name B, A = 100, B = 500 Deprecated: Use of "parent" in callables is deprecated in /in/TBRl6 on line 15 Class name B, A = a, B = b

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:
56.7 ms | 402 KiB | 8 Q