Re: change request for function highlight_string
| From: | Lars Torben Wilson | Date: | Wed, 20 Feb 2002 22:28:56 +0000 |
| Subject: | Re: change request for function highlight_string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-85623@lists.php.net to get a copy of this message | ||
On Wed, 2002-02-20 at 14:13, Rein Velt wrote:
> At this moment (php4.1.1) the function "highlight_string" has the following
> syntax:
>
>
> [quote]
> bool highlight_string ( string str)
> This function prints out a syntax highlighted version of str using the
> colors defined in the built-in syntax highlighter for PHP. Returns TRUE or
> FALSE.
> [/quote]
>
>
>
> The function will be more flexible if it returns a string (with highlights)
> and nothing is printed directly.
The Bugs Database is the place for feature requests:
http://bugs.php.net. But read the instructions first. :)
Anyway, as noted in the docs, you can do this yourself:
<?php
error_reporting(E_ALL);
function my_highlight_string($string) {
ob_start();
highlight_string($string);
$retval = ob_get_contents();
ob_end_clean();
return $retval;
}
$str = my_highlight_string('<?php
error_reporting(E_ALL);
function my_highlight_string($string) {
ob_start();
highlight_string($string);
$retval = ob_get_contents();
ob_end_clean();
return $retval;
}
?>');
echo "The highlighted string: $str";
?>
Cheers,
Torben
> str highlight_string ( string str)
> This function returns a string containing a syntax highted version of str
> using the colors defined in the built-in syntax highlighter for PHP. Returns
> TRUE or FALSE.
>
> Reference:
> http://lxr.php.net/source/ZendEngine2/zend_highlight.c#84
>
>
>
> --
> Rein Velt web application engineering
> mailto:rein@velt.net
> http://velt.net
--
Torben Wilson <torben@php.net>
http://www.thebuttlesschaps.com
http://www.hybrid17.com
http://www.inflatableeye.com
+1.604.709.0506