3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $name; protected $age; public $gender; public static $time; function __construct($name, $age, $gender, DateTime $time) { $this->name = $name; $this->age = $age; $this->gender = $gender; self::$time = $time->getTimestamp(); } } $foo = new Foo('hchen', 10, 'M', new DateTime('now')); $newFoo = Closure::bind( function() { return get_object_vars($this); }, $foo, 'Foo'); print_r(PHP_EOL.'<pre>========== START DEBUG: $newFoo =========='.PHP_EOL); print_r($newFoo()); print_r(PHP_EOL.'========== END OF $newFoo DEBUG ==========</pre>'.PHP_EOL); die(); ?>
Output for git.master, git.master_jit, rfc.property-hooks
<pre>========== START DEBUG: $newFoo ========== Array ( [name] => hchen [age] => 10 [gender] => M ) ========== END OF $newFoo DEBUG ==========</pre>

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:
77.22 ms | 401 KiB | 8 Q