3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { var $my_public = array(); //forward php4 to constructor function foo($one, $two) { $this->my_public[] = 'php4 constructor'; return $this->__construct($one, $two); } //constructor php5 function __construct($one, $two) { $this->my_public[] = 'php5 constructor'; $this->my_public[] = $one; $this->my_public[] = $two; register_shutdown_function(array(&$this, "__destruct")); } function dump() { print_r($this->my_public); } function __destruct () {} } $test = new foo(); $test->dump();
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught ArgumentCountError: Too few arguments to function foo::__construct(), 0 passed in /in/m5sLE on line 32 and exactly 2 expected in /in/m5sLE:15 Stack trace: #0 /in/m5sLE(32): foo->__construct() #1 {main} thrown in /in/m5sLE on line 15
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:
35.14 ms | 401 KiB | 8 Q