Jump to content

Find 'n Replace doesn't replace


sniperscope

Recommended Posts

Hi

i wrote a find and replace code but my code replace last value of array and skip the first, second.... values in the array.

Please give me an idea because i stack with this code.

 

Regards

 

$KeyWord 	= explode("\n", $RowGetWords['KEYWORDS']);
$Replace 	= explode("\n", $RowGetWords['ReplaceTo']);

for($i=0; $i<count($KeyWord); $i++){
$pattern = $KeyWord[$i];
$replace = "<a href=\"" .$URL. "\" target=\"_blank\" >" .$Replace[$i]. "</a>";
$html = str_replace($pattern, $replace, $Row['MessageBody']);
}

Link to comment
https://forums.phpfreaks.com/topic/209188-find-n-replace-doesnt-replace/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.