From Wiki

PHP: PregReplace

preg_replace()


<?PHP
$pattern[0] = '/\[\[tamad\]\]/';
$pattern[1] = '/\[\[sihirli_numara\]\]/';
$replacement[0] = "AdSoyad";
$replacement[1] = "123456789";
$subject = "Metin[[tamad]][[tamad]][[sihirli_numara]]";
$limit = "1"; //Sadece ilk buldu&#287;u de&#287;erleri de&#287;i&#351;tirir. Hepsi i�in "limit = -1"
$subject = preg_replace($pattern, $replacement, $subject, $limit);
echo $subject; 


Retrieved from http://kozgun.net/wiki/pmwiki.php?n=PHP.PregReplace
Page last modified on September 07, 2005, at 12:32 PM