Right, basically I'm trying to create a function that will I can use to change user inputted tags like [b][/b] to strong -- /strong etc.
function wrap(){
$content = 'Text [b]here[/b]... ';
$replace = str_replace("[b]", "<strong>", $content);
$replace = str_replace("[/b]", "</strong>", $content);
echo $replace;
}
When the user submits a new post, customising it using bold tags, em.. it will get displayed on the view post page...
<?php echo wrap("$post->postContent"); ?>
My question is how do I get this to work... I want to be able to create several replacements and just wrap each php echo with the function.
I've been playing with tons of alternative methods of code but none have proven to be completely successful.
Irrelevant but possibly useful information.
- OS: OS X Mavericks 10.9.2 (MacBook Pro)
- PHP Version 5.5.10 (MAMP PRO 3)
- Sublime Text 3 (Editor)