将完整地址转换为分隔符,城市,地区,邮政编码等

I have been searched by the internet, however I didn't find a perfect solution, so I faith that someone already did something like this.

So my issue is, I'm using a webservice were you send the VAT number and if is valid you got the Company info. However the address received is the full address not divided by parts.

For example: Google Ireland VAT is IE6388047V

I got: Company Name: GOOGLE IRELAND LIMITED Address: 3RD FLOOR ,GORDON HOUSE ,BARROW STREET ,DUBLIN 4

So what I need is something like this: 3RD FLOOR ,GORDON HOUSE ,BARROW STREET ,DUBLIN 4 Converts this to:

Address: Ringsend Post Office, Gordon House, Barrow St

City: Dublin 4

Country: Ireland

Someone can help me and make the day? Thank you so much!

You can separate your address with array using PHP function explode(",",$address). It will separate your address after ", " and store in array...

Parsing addresses is challenging because of the many formats you will encounter, even within a single country. There are services that can parse the input and even verify whether the address exists. They usually return the address in components as well as a composed whole. Unfortunately, parsing international addresses is usually only available via a paid service. One such service is provided by smartystreets.com:

(Disclosure: I'm a developer at smartystreets.)