Use `$resulting_user_ids` as a map and use isset. Or even better, unset the user_ids you don't need here earlier.