Change for loop to foreach

Yes, but there is always user input in $_GET which is why we take out any duplicates if any exist.