3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SubObject { static $instances = 1; public $instance; public function __construct() { $this->instance = ++self::$instances; } public function __clone() { $this->instance = ++self::$instances; } } class MyCloneable { public $object1; public $object2; function _clone() { $this->object1 = clone ($this->object1); } } $obj = new MyCloneable(); $obj->object1 = new SubObject(); $obj->object2 = new SubObject(); $obj2 = clone $obj; function iterateObject($input) { if (is_int($input)) echo "[instance] => ".$input."\n"; else foreach ($input as $val) iterateObject($val); } iterateObject($obj); iterateObject($obj2);
Output for git.master, git.master_jit, rfc.property-hooks
[instance] => 2 [instance] => 3 [instance] => 2 [instance] => 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:
44.07 ms | 401 KiB | 8 Q