adamlacombe Posted July 24, 2009 Share Posted July 24, 2009 I want it so when someone posts [ code ] and [ /code ] it replaces it with <code> and </code> I have this: $comment = str_replace([ code ], <code>, $comment); $comment = str_replace([ /code ], </code>, $comment); But get this error: Parse error: syntax error, unexpected '[', expecting ')' in /home/media/test/pages/forum.php on line 328 How do I fix it? Thanks in advanced! Link to comment https://forums.phpfreaks.com/topic/167305-solved-str_replace-help/ Share on other sites More sharing options...
rhodesa Posted July 24, 2009 Share Posted July 24, 2009 you need some quotes in there: $comment = str_replace('[ code ]', '<code>', $comment); $comment = str_replace('[ /code ]', '</code>', $comment); Link to comment https://forums.phpfreaks.com/topic/167305-solved-str_replace-help/#findComment-882163 Share on other sites More sharing options...
adamlacombe Posted July 24, 2009 Author Share Posted July 24, 2009 ooh, ok duh lol Thanks Link to comment https://forums.phpfreaks.com/topic/167305-solved-str_replace-help/#findComment-882169 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.