this is from an array i have
[citystatezip] => New York, NY 50805-2578
i’m trying to have it in the format below
[city] => New York
[state] => NY
[zip] => 50805-2578
i was using regex in php..but got nowhere.
thanks for the help.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try this regex:
Translated into code:
Gives:
With this regex:
There is some input validation (eg: requires input to be in the form of: XXXXXXX, YY NNNNN-NNNN)
Spaces are optional
The last 4 digits of the zip are optional