I need some PHP code to do the following, any ideas? There are so many
things to take into consideration, but places like mapquest seem to be
able to handle this ok.
I would like this to be written as a function
parseaddress($a ddress)
Given a variable $address parse it out into the following variables:
$housenumber
$streetname
$type
$prefix
$postfix
Examples:
$address = "123 N Main Street"
would return:
$housenumber = "123"
$streename = "Main"
$type = "Street"
$prefix = "North"
$postfix = ""
$address = "123 Main Street N"
would return:
$housenumber = "123"
$streename = "Main"
$type = "Street"
$prefix = ""
$postfix = "North"
$address = "123 Main Street North"
would return:
$housenumber = "123"
$streename = "Main"
$type = "Street"
$prefix = ""
$postfix = "North"
$address = "123 Main Rd"
would return:
$housenumber = "123"
$streename = "Main"
$type = "Road"
$prefix = ""
$postfix = ""
$address = "123 Arlington Centre Blvd."
would return:
$housenumber = "123"
$streename = "Arlington Centre"
$type = "Boulevard"
$prefix = ""
$postfix = ""
$type could contain the following values:
Road
Street
Place
Court
Lane
Boulevard
(more types?)
(each type may be abreviated ie "Rd","St"," pl" etc)
$prefix or $postfix could contain the following values:
North
South
East
West
(each could be abreviated ie "N","S" etc)
--
[ Sugapablo ]
[ http://www.sugapablo.com <--music ]
[ http://www.sugapablo.net <--personal ]
[ sugapablo@12jab ber.com <--jabber IM ]
things to take into consideration, but places like mapquest seem to be
able to handle this ok.
I would like this to be written as a function
parseaddress($a ddress)
Given a variable $address parse it out into the following variables:
$housenumber
$streetname
$type
$prefix
$postfix
Examples:
$address = "123 N Main Street"
would return:
$housenumber = "123"
$streename = "Main"
$type = "Street"
$prefix = "North"
$postfix = ""
$address = "123 Main Street N"
would return:
$housenumber = "123"
$streename = "Main"
$type = "Street"
$prefix = ""
$postfix = "North"
$address = "123 Main Street North"
would return:
$housenumber = "123"
$streename = "Main"
$type = "Street"
$prefix = ""
$postfix = "North"
$address = "123 Main Rd"
would return:
$housenumber = "123"
$streename = "Main"
$type = "Road"
$prefix = ""
$postfix = ""
$address = "123 Arlington Centre Blvd."
would return:
$housenumber = "123"
$streename = "Arlington Centre"
$type = "Boulevard"
$prefix = ""
$postfix = ""
$type could contain the following values:
Road
Street
Place
Court
Lane
Boulevard
(more types?)
(each type may be abreviated ie "Rd","St"," pl" etc)
$prefix or $postfix could contain the following values:
North
South
East
West
(each could be abreviated ie "N","S" etc)
--
[ Sugapablo ]
[ http://www.sugapablo.com <--music ]
[ http://www.sugapablo.net <--personal ]
[ sugapablo@12jab ber.com <--jabber IM ]
Comment