Jump to content

$ in preg_replace


arunner

Recommended Posts

hey, I'm having big problems with a scrap of code I made.  I traced the bug down, and for some reason..it's here; and I can't figure it out. I think it's the $ in the preg_replace  function. Here's my code:

 

		//set patterns
	$pattern = array(
		'/\$PARENT_PATH\$/',
		'/\$PATH\$/'
	);
	//set replacements
	$replacement = array(
		$parent_path,
		$path
	);
	foreach($a['html'] as $key=>$value){
		echo $key . "BLAH";
		//make replacements
		$value = preg_replace($pattern, $replacement, $value);
		//add new lines on the end of every html section
		$value = $value . $n;
		//set value in user html array
		$a['html'][$key] = $value;
	}

 

any help would be greatly appreciated. :]

Link to comment
https://forums.phpfreaks.com/topic/184490-in-preg_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.