sparkx 0 Report post Posted June 24, 2007 OK well I am making a new php program and I am trying to add bbcode to it. Anyway I was going to replace each thing by it self, but that could cause errors. Anyway is there a way to make a variable be anything? Here is an example: This is the bbcode:[color=00FF00]Hey[/color]In my php:$bbcode = array("[color=".$a."]");$html = array( "<font color='#".$a."'>");$topic_content = str_replace($bbcode, $html, $posted_bbcode);So I want $a to be any variable but the same variable as used before. Do you get what I am saying? It is a little confusing but basicly what is the best way to make bbcode? It may not even involve the str_replace but this was the easyiest way to explain what I wanted.Thanks for everyone that helps,Sparkx Share this post Link to post Share on other sites
Quatrux 4 Report post Posted June 24, 2007 It can be done in several ways, but as for your problem, I think you could just use a regular expression, even though I like to avoid them, I never got into regular expressions, just found them or asked for them on IRC channels, you would need to use preg_replace(); read on it on the php manual Share this post Link to post Share on other sites