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! Quote 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); Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/167305-solved-str_replace-help/#findComment-882169 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.