Reply to Re: [PHP] replace

Your name:

Reply:


Posted by tg-php on 09/19/05 23:32

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.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация