Syntax Highlighting variables not appearing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Can anyone explain why this is happening.

I am using the following code For giving code examples on my website with syntax highlighting

$text = '<?php \$my_code = "echo 'text text text text'; \$foo = 'bar';"; example_function(\$my_code); ?&gt';
$body = preg_replace('/&lt;(.*?)&gt;/es', 'highlight_string("<\\1>", true)', $text);
echo $body; //Returns: <?php = 'echo \'text text text text\'\'; = \'bar\'; highlight_string(, true); ?> //I want: <?php $my_code = "echo 'text text text text'; $foo = 'bar';"; example_function($my_code); ?>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux