Flip associative array and store new values in subarrays to prevent losing duplicated values

$grouped = array();
foreach ($input as $choice => $group) {
    $grouped[$group][] = $choice;
}

var_dump($grouped);