Jump to content

undo html


vividona

Recommended Posts

I am using htmlspecialchars() function to change some of html tags

Now I need to highlight my php codes.

[code=php:0]public function bb_php($string)
{
	string = str_replace ( '&', '&', $string );
        $string = str_replace ( ''', '', $string );
        $string = str_replace ( '"', '', $string );
        $string = str_replace ( '<', '<', $string );
        $string = str_replace ( '>', '>', $string );

	$match = array('#\[php\](.*?)\[\/php\]#se');
	$replace = array("'<div>'.highlight_string(stripslashes('$1'), true).'</div>'");

	return preg_replace($match, $replace, $string);
}

 

This code undo html tags from the whole page.

I need to remove it only from php codes[/code]

Link to comment
https://forums.phpfreaks.com/topic/192233-undo-html/
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.