note 31738 added to function.preg-replace

From: Date: Fri, 02 May 2003 01:12:32 +0000
Subject: note 31738 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-47369@lists.php.net to get a copy of this message
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. -- http://www.php.net/manual/en/function.preg-replace.php http://master.php.net/manage/user-notes.php?action=edit+31738 http://master.php.net/manage/user-notes.php?action=delete+31738 http://master.php.net/manage/user-notes.php?action=reject+31738

« previous php.notes (#47369) next »