note 31738 deleted from function.preg-replace by sniper
| From: | sniper@php.net | Date: | Sun, 07 Sep 2003 22:01:23 +0000 |
| Subject: | note 31738 deleted from function.preg-replace by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-55683@lists.php.net to get a copy of this message | ||
Note Submitter: webmaster@wolfz.com
----
For simple reference, to basically help a few new PHP programmers out, I've done a little
'scripting' PHP scripting. Basically, the code below will take a code you specify, and
make it HTML code. This can be helpful if you are making a game, and don't want to allow HTML,
but you want to allow font colors and such.
$s=preg_replace("/\[c=(.*?)\](.*?)\[\/\]/i", "<font
color=$1>$2</font>", $s);
The above line would take text such as this [c=blue]TEXT[/] and convert it into <font
color=blue>TEXT</font>. This is good for forums and other such uses.