Jump to content

highlight_stirng with preg_replace


Roee

Recommended Posts

hi

i tried to write this:
[code]
$content = $_POST['content'];
$match = array('#\[PHP\](.*?)\[\/PHP\]#se');
$replace = array("'<div style=\"margin:25px; margin-top:5px\"><div class=\"smallfont\" style=\"margin-bottom:2px\">PHP code:</div><div class=\"alt2\" style=\"margin:0px; padding:6px; border:1px inset; overflow:auto\"><code style=\"white-space:nowrap\"><div dir=\"ltr\" style=\"text-align:left;\">'.highlight_string(stripslashes('$1'), true).'</div></code></div></div>'");
$content = preg_replace($match, $replace, $content);[/code]


but if i try to write a " it makes mysql error:
[b]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\' (ASCII=92) state=1[/b]

why?

thanks
Link to comment
https://forums.phpfreaks.com/topic/15058-highlight_stirng-with-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.