note 38504 added to function.preg-replace
| From: | spam at websaait dot nl | Date: | Wed, 24 Dec 2003 15:57:05 +0000 |
| Subject: | note 38504 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-62426@lists.php.net to get a copy of this message | ||
function php_highlight($input)
{
$output = "<br><table cellspacing=0 cellpadding=0 border=0 width=100%>
<tr><td width=40><td class=date>PHP</td></tr> <tr><td
height=1><td bgcolor=808080 height=1></tr> <tr><td><td align=left
valign=top>";
ob_start();
highlight_string($input);
$output .= ob_get_contents();
ob_end_clean();
$output .= "</tr> <tr><td height=1><td bgcolor=808080
height=1></tr> </table><p>";
return $output;
}
$msg = preg_replace ("/\[php\]((.|\n)*?)\[\/php\]/e",
'php_highlight("\\1")', $msg);
Does anyone know how to adept this so the variabels will not disappear?
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38504
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38504&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38504&report=yes
Search -- http://master.php.net/manage/user-notes.php