Get a list of all users and into an array
In Drupal 7 you can fetch all the users using entity_load like following,

$users = entity_load('user');


and array_keys($users) will gives you the array of uid's