3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(gc_enabled()); $objstore = new SplObjectStorage(); $a = new StdClass; $b = new StdClass; $c = new StdClass; $a->b = $b; $b->a = $a; $c->b = $b; $b->c = $c; $a = function() { $d = new StdClass; $e = new StdClass; $d->e = $e; $e->d = $d; }; $a(); $objstore->attach($a); $objstore->attach($b); $objstore->attach($c); gc_collect_cycles(); var_dump($objstore); print serialize($objstore);
Output for git.master, git.master_jit, rfc.property-hooks
bool(true) object(SplObjectStorage)#1 (1) { ["storage":"SplObjectStorage":private]=> array(3) { [0]=> array(2) { ["obj"]=> object(Closure)#5 (0) { } ["inf"]=> NULL } [1]=> array(2) { ["obj"]=> object(stdClass)#3 (2) { ["a"]=> object(stdClass)#2 (1) { ["b"]=> *RECURSION* } ["c"]=> object(stdClass)#4 (1) { ["b"]=> *RECURSION* } } ["inf"]=> NULL } [2]=> array(2) { ["obj"]=> object(stdClass)#4 (1) { ["b"]=> object(stdClass)#3 (2) { ["a"]=> object(stdClass)#2 (1) { ["b"]=> *RECURSION* } ["c"]=> *RECURSION* } } ["inf"]=> NULL } } } Fatal error: Uncaught Exception: Serialization of 'Closure' is not allowed in /in/fHNQG:33 Stack trace: #0 /in/fHNQG(33): serialize(Object(SplObjectStorage)) #1 {main} thrown in /in/fHNQG on line 33
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:
41.45 ms | 402 KiB | 8 Q