If necessary, you can still extract ($ users) after the array_combine () function; and then the variables of the same name will appear in the current scope, the values of which will coincide with their names.
$str = 'user1, user2, user3, user4, user5'; $users = explode(', ', $str); $users = array_combine($users, $users); echo '<pre>'; var_dump($users); echo '</pre>'; /* array(5) { ["user1"]=> string(5) "user1" ["user2"]=> string(5) "user2" ["user3"]=> string(5) "user3" ["user4"]=> string(5) "user4" ["user5"]=> string(5) "user5" } */