Re: how can I do this !!
| From: | _lallous | Date: | Thu, 25 Oct 2001 14:49:21 +0000 |
| Subject: | Re: how can I do this !! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-72271@lists.php.net to get a copy of this message | ||
<?
$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" <alawi@php4web.com> wrote in message
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