AW: AW: Parsing Strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux