I have a set of values that I'm pushing into an array in the order they occur
$valsArray = array(); 
//I process each value from a file (code removed for simplicity) 
//and then add into the array 
$valsArray[] = $val; 
How do I turn this into an associative array instead where the value gets inserted (as $key of associative array) only if it doesn't exist. If it does exist increment its count ($value of associative array) by 1. I'm trying to find a more efficient way of handling those values compared to what I'm doing now.