Syntax Highlighting variables not appearing
| From: | Tom Whitbread | Date: | Mon, 28 Feb 2005 14:08:00 +0000 |
| Subject: | Syntax Highlighting variables not appearing | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-209590@lists.php.net to get a copy of this message | ||
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); ?>';
$body = preg_replace('/<(.*?)>/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); ?>