Posts: 1,832
Location: Somewhere else entirely
|
I found this in the 'User comments' list on the highlight_string() PHP manual page:
PHP Code:
<?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);
}
?>
Seems you just enclose $1 in the function call (with stripslashes too) and then concatenate it with the replace string?
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';
Please login or register to view this content. Registration is FREE (aka MSN handwriting for forums)
|