3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 5.4.0 - 5.4.24
Parse error: syntax error, unexpected end of file in /in/V86vF on line 38
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected $end in /in/V86vF on line 38
Process exited with code 255.