3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = new StdClass(); $b = new StdClass(); $array1 = array($a, $a, $b); $array2 = array($a, $b, $b); 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; } $count1 = countHashes($array1); $count2 = countHashes($array2); var_dump($count1); var_dump($count2);
Output for 5.4.0 - 5.4.24
Parse error: syntax error, unexpected end of file in /in/gWlaC on line 27
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected $end in /in/gWlaC on line 27
Process exited with code 255.

preferences:
179.67 ms | 1395 KiB | 61 Q