3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = new \StdClass; $bar = new \StdClass; $foo->bar = $bar; $bar->foo = $foo; $array = array('foo' => $foo, 'bar' => $bar); $hash = array(); rwalk($array); function rwalk($array) { if (is_array($array)) { foreach ($array as $key => $value) { if (is_object($value)) { $objHash = spl_object_hash($value); $value = (array) $value; } if (is_array($value) && !in_array($objHash, $hash)) { $hash[] = $objHash; rwalk($value); } } } }
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $hash in /in/CkXC4 on line 20 Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /in/CkXC4:20 Stack trace: #0 /in/CkXC4(20): in_array('000000000000000...', NULL) #1 /in/CkXC4(10): rwalk(Array) #2 {main} thrown in /in/CkXC4 on line 20
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.63 ms | 401 KiB | 8 Q