3v4l.org

run code in 300+ PHP versions simultaneously
<?php function countHashes ($array) { $count = array(); foreach ($array as $val) { $hash = spl_object_hash($val); if (! isset($count[$hash])) { $count[$hash] = 0; } $count[$hash]++; } return $count; }; function checkWhetherSame($array1, $array2) { $count1 = countHashes($array1); $count2 = countHashes($array2); if (count($count1) === count($count2)) { foreach ($count1 as $key => $value) { if ($count2[$key] !== $value) { return false; } } } return true; }; $a = new StdClass(); $b = new StdClass(); $array1 = array($a, $a, $b); $array2 = array($a, $b, $b); var_dump(checkWhetherSame($array1, $array2));
Output for git.master, git.master_jit, rfc.property-hooks
bool(false)

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:
43.48 ms | 401 KiB | 8 Q