Yes, a police officer can stop you if you are walking down the street at 3 a.m. and ask you for your ID, and you have to provide it.  There is case law in Arizona that if you are a pedestrian, the police officer can not require you to produce a drivers license, and that a student ID, for example, may suffice.  The police officer can not search you (except for a brief frisk) without probable cause.  I can not imagine why the police officer requested your email address.  With the zip code, the officer may have just been checking against the driver's license, to see if you knew it.