I would like to know if there's a function or series of functions that can easily turn an address into separate variables. Preferably, I'd like to use JavaScript or PHP.

What I have is an input field that says "enter your address". This can have many input values, such as a zip code, street name, state abbreviation, state name, house number, and so on. It can also be in any order. What I want to do is have a function choose which parts of the string are which (street name, zip code, state) and have it turn them into variables.

This is a common thing on many websites, so I imagine there's an easy way to do this. Anyone have any suggestions?

Thanks,
Multimediocrity