Javascript debugger
Website design
↑
Outputs or returns a syntax highlighted version of the given PHP code using the colors defined in the built-in syntax highlighter for PHP.
The PHP code to be highligthed. This should include the opening tag.
Set this parameter to TRUE
to make this function return the
highlighted code.
If return is set to TRUE
, returns the highlighted
code as a string instead of printing it out. Otherwise, it will return
TRUE
on success, FALSE
on failure.
<?php
highlight_string('<?php phpinfo(); ?>');
?>
The above example will output (in PHP 4):
<code><font color="#000000">
<font color="#0000BB"><?php phpinfo</font><font color="#007700">(); </font><font color="#0000BB">?></font>
</font>
</code>
The above example will output (in PHP 5):
<code><span style="color: #000000">
<span style="color: #0000BB"><?php phpinfo</span><span style="color: #007700">(); </span><span style="color: #0000BB">?></span>
</span>
</code>
This function internally uses the output buffering with this parameter so it can not be used inside ob_start() callback function.
highlight_file() |