sorting array after array_count_values
        Posted  
        
            by umermalik
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by umermalik
        
        
        
        Published on 2010-05-18T11:19:41Z
        Indexed on 
            2010/05/18
            11:50 UTC
        
        
        Read the original article
        Hit count: 237
        
hi to all!
I have an array of products
$products = array_count_values($products);
now I have an array where $key is product number and $value is how many times I have such a product in the array. I want to sort this new array that product with the least "duplicates" are on the first place, but what ever I use (rsort, krsort,..) i loose product numbers (key).
any suggestions?
thanks.
© Stack Overflow or respective owner