Please, be more specific. You want to return an error or success, but still continue the loop. That is not possible - once you return, the loop is done. Probably, you can return two array references: the first array would contain successful users, the second one the failed users.