<?
$mem = '
----------
bla bla bla
[phpcode]
<?
echo \'hello word\';
?><?
[/phpcode]
bla bla bla
-----------
'; //'
$re = '/\[phpcode\](.+?)\[\/phpcode\]/is';
if (preg_match($re, $mem, $matches))
{
ob_start();
highlight_string($matches[1]);
$html = ob_get_contents();
ob_end_clean();
$out = preg_replace($re, $html, $mem);
echo $out;
}
?>
this should do!
"Alawi" <[EMAIL PROTECTED]> wrote in message
008f01c15da2$ddf4fd30$d43f47d4@php">news:008f01c15da2$ddf4fd30$d43f47d4@php...
i have txt file have this words
----------
bla bla bla
[phpcode]
<?
echo 'hello word';
?>
[/phpcode]
bla bla bla
-----------
now I want to convert the code that are between [phpcode] and [/phpcode] to
colorized code ..
How I can do that
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]