3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arrayName = array(1,2,1,3,4,3,2,5); $values = array_unique($arrayName); Foreach($values as $val){ $count[$val] = count(array_keys($arrayName, $val)); } Var_dump($count);

preferences:
23.75 ms | 406 KiB | 5 Q