Re: replace

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

 



I hope this is what you were looking for:

$contents = "Numbers 1, 2, 3, 4 and 5 will be replaced with A, B, C, D, and E";
$searcharr =  array("1", "2", "3", "4", "5");
$replacearr = array("A", "B", "C", "D", "E");
$newcontents = str_replace($searcharr, $replacearr, $contents);

echo $newcontents;

Numbers A, B, C, D and E will be replaced with A, B, C, D, and E

Good luck!

-TG

= = = Original message = = =

Hi all

if I have an array of chars to be replaced array(1,2,3,4,5);
and an arry of chars to replace with array(a,b,c,d,e)

what function do I need to replace all chars from one arry to the other that 
are found in the var $contents

Thanks

M 


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.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