3v4l.org

run code in 300+ PHP versions simultaneously
<?php class B { public $value; function __construct($value){ $this->value = $value; } function __wakeup() { if($this->value instanceof C) $this->value = C::$instance; } } class C { static public $instance; } C::$instance = new C; $A = array( new B(C::$instance), new B(C::$instance), new B(C::$instance) ); var_dump($A); var_dump($A); $A = unserialize(serialize($A)); var_dump($A);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [0]=> object(B)#2 (1) { ["value"]=> object(C)#1 (0) { } } [1]=> object(B)#3 (1) { ["value"]=> object(C)#1 (0) { } } [2]=> object(B)#4 (1) { ["value"]=> object(C)#1 (0) { } } } array(3) { [0]=> object(B)#2 (1) { ["value"]=> object(C)#1 (0) { } } [1]=> object(B)#3 (1) { ["value"]=> object(C)#1 (0) { } } [2]=> object(B)#4 (1) { ["value"]=> object(C)#1 (0) { } } } array(3) { [0]=> object(B)#5 (1) { ["value"]=> object(C)#1 (0) { } } [1]=> object(B)#7 (1) { ["value"]=> object(C)#1 (0) { } } [2]=> object(B)#8 (1) { ["value"]=> object(C)#1 (0) { } } }

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