note 49506 added to function.highlight-string
| From: | gaggge at gmail dot com | Date: | Sun, 30 Jan 2005 16:26:42 +0000 |
| Subject: | note 49506 added to function.highlight-string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84242@lists.php.net to get a copy of this message | ||
This is a little function for highlighting bbcode-stylish PHP code from a mysql database.
(Like this: [php]<?php echo "test"; ?>[/php])
<?php
function bbcode($s)
{
$s = str_replace("]\n", "]", $s);
$match = array('#\[php\](.*?)\[\/php\]#se');
$replace = array("'<div>'.highlight_string(stripslashes('$1'),
true).'</div>'");
return preg_replace($match, $replace, $s);
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.highlight-string.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49506
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49506&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49506&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49506&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49506&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49506&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49506&report=yes
Search -- http://master.php.net/manage/user-notes.php