AW: AW: [PHP] Parsing Strings

From: Date: Sat, 06 Dec 2008 00:52:33 +0000
Subject: AW: AW: [PHP] Parsing Strings
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-284220@lists.php.net to get a copy of this message
Hi, On Sa 06.12.2008 01:30 Jason wrote: > Can you explain how to do an address now into City, State, Zip > Like: cortland, ny 13045 Test this: $string = "cortland, ny 13045"; $search = array(", ", ","); # if there is no space after the comma, we make this ;-) $replace = array(" ", " "); $newString = str_replace($search, $replace, $string); $array = explode(" ", $newString); -------------------------------------- Old String: cortland, ny 13045 New String: cortland ny 13045 Array ( [0] => cortland [1] => ny [2] => 13045 ) --------------------------------------- Regards from Stuttgart Conny PS: Sorry about my perfect english __________ Hinweis von ESET NOD32 Antivirus, Signaturdatenbank-Version 3667 (20081205) __________ E-Mail wurde gepruft mit ESET NOD32 Antivirus. http://www.eset.com

« previous php.general (#284220) next »