I have a order form the send a order to the client on a street address What I want to do is strip the text from the address and leave the address number
ie. 1234 Neverland Rd. Should read 1234
Can anybody help
TIA Richie TM
Logically, the numbers will always be the first part of an address, followed by a space. So, I wrote this code:
$address = "1234 Neverland Rd."; $number = substr($address, 0, strpos($address, " ")); echo $number;
Alternately,
$number = eregi_replace("[0-9]","",$address); echo $number;
This won't work for my address, "1812 W. 26th St". It'll return "181226", and that's not right.
Oops. I probably shouldn't have posted my address. Oh well.