protected function shuffle_assoc(&$array) {
        if (count($array) > 1) {
            // $keys needs to be an array, no need to shuffle 1 item or empty arrays, anyway
            $keys = array_keys($array);
            shuffle($keys);
            foreach($keys as $key) {
                $new[$key] = $array[$key];
            }
            $array = $new;
        }
        return true; // because this behaves like in-built shuffle(), which returns true
    }
protected function shuffle_assoc(&$array) {
        if (count($array) > 1) {
            // $keys needs to be an array, no need to shuffle 1 item or empty arrays, anyway
            $keys = array_keys($array);
            shuffle($keys);
            foreach($keys as $key) {
                $new[$key] = $array[$key];
            }
            $array = $new;
        }
        return true; // because this behaves like in-built shuffle(), which returns true
    }
protected function shuffle_assoc ( & $ array ) { if ( count ( $ array ) > 1 ) { // $keys needs to be an array, no need to shuffle 1 item or empty arrays, anyway $ keys = array_keys ( $ array ) ; shuffle ( $ keys ) ; foreach ( $ keys as $ key ) { $ new [ $ key ] = $ array [ $ key ] ; } $ array = $ new ; } return true ; // because this behaves like in-built shuffle(), which returns true }
Shuffle the order of array elements preserving the key=>values

@param array $array to be shuffled
@return true
Shuffle the order of array elements preserving the key = > values