Listing all capabilities in dropdown is returning boolean

Trying to put a list of all possible caps in a dropdown. I can only get it to return 1s (boolean true). If I use var_dump($user->allcaps); it does produce the actual cap names, but when I plug this into my function, it goes to boolean. Have tried using various settype statements; nothing has worked. Here’s the function currently:

add_shortcode('capsdropdown', 'sc_capsdropdown');
function sc_capsdropdown($attr) {
$user = get_user_by('id', '1');
$capslist = $user->allcaps;
$dropdown = '<select>';
foreach($capslist as $cap){
$dropdown .= '<option value="'.$cap.'">'.$cap.'</option>';
}
$dropdown .= '</select>';
return $dropdown;
}

Resolved. This works:

foreach($capslist as $cap=>$caps){ $dropdown .= '<option value="'.$cap.'">'.$cap.'</option>'; }

Solutions Collecting From Web of "Listing all capabilities in dropdown is returning boolean"

Solved with this Answer at Stack Overflow.

Each Array Key was the actual name of the capability […] You were searching for the capabilities by name, and since you were only seeing 1s in the output, I figured what you were looking for was in the keys.

foreach($capslist as $cap=>$caps){ 
    $dropdown .= '<option value="'.$cap.'">'.$cap.'</option>'; 
}