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)) { $value = (array) $value; $objHash = spl_object_hash($value); } if (is_array($value) && !in_array($objHash, $hash)) { $hash[] = $objHash; rwalk($value); } } } }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: spl_object_hash(): Argument #1 ($object) must be of type object, array given in /in/IPNjZ:17 Stack trace: #0 /in/IPNjZ(17): spl_object_hash(Array) #1 /in/IPNjZ(10): rwalk(Array) #2 {main} thrown in /in/IPNjZ on line 17
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:
31.41 ms | 401 KiB | 8 Q