Got the solution (i wonder why i always get into the list, post the question
and end up with the answer 15 minutes later. I'm obviously too nervous and
rush for help :-) )
The correct code is the following:
<?
$text = <<< EOT
Let's se a simple sample of how to use a class in PHP
<?
class CTest
{
var $variable1; //Propiedad
function DoThing() //M�todo
{
echo 'esto es una prueba de clase';
echo 'una clase es mejor que nada';
}
}
?>
And that's all, folks!!!
EOT;
$text =
preg_replace("/(.*)(<\?.*?\?>)(.*)/imse","'\\1<br/>'.highlight_string('\\2',
TRUE).'<br/>\\3'",$text);
echo $text;
?>
The error was the TRUE parameter to highlight_string(). The RegExp was
allright.
Note that if you use "" in the PHP code you want to color, you'll receive an
error. My solution for that:
$text = str_replace("\"","'",$text);
As the ' is also colored using highlight_string()
So, here it is the solution. Now, i'm running onto making my PHP forum !!!
Cya all!!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php