ChadNomad Posted May 31, 2008 Share Posted May 31, 2008 I've been using this to highlight PHP code: $newcontent = preg_replace('/\[command\](.*?)\[\/command\]/ie', 'highlight_string(\'$1\', TRUE)', nl2br($page_information[content])); The only problem is it doesn't work on content that has multiple lines. Confused... Also, another question, how would I wrap a html div block around the highlight_string function? Any help appreciated. Link to comment https://forums.phpfreaks.com/topic/108074-formatting-code-with-preg_replace/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.