3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Function Argument Unpacking in PHP 5.6 complements Variadic Functions! */ class Foo { public function __construct($arg1, $arg2, $arg3) { /* Do stuff constructor with arguments */ $this->arg1 = $arg1; $this->arg2 = $arg2; $this->arg3 = $arg3; } } class Bar extends Foo { public function __construct(...$args) { /** * Before argument unpacking in 5.6 we would use * call_user_func_array + func_get_args to accomplish * the same thing. */ // The intent here is to call the parent constructor parent::__construct(...$args); // Looks much nicer in 5.6 } } $bar = new Bar(1,2,3); var_dump($bar);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property Bar::$arg1 is deprecated in /in/6ibqf on line 6 Deprecated: Creation of dynamic property Bar::$arg2 is deprecated in /in/6ibqf on line 7 Deprecated: Creation of dynamic property Bar::$arg3 is deprecated in /in/6ibqf on line 8 object(Bar)#1 (3) { ["arg1"]=> int(1) ["arg2"]=> int(2) ["arg3"]=> int(3) }

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