PHP.nl

highlight_string

highlight_string

Syntax highlighting of a string

 **highlight_string** string $string bool $return

Outputs or returns html markup for a syntax highlighted version of the given PHP code using the colors defined in the built-in syntax highlighter for PHP.

stringThe PHP code to be highlighted. This should include the opening tag.

returnSet this parameter to true to make this function return the highlighted code.

If is set to true, returns the highlighted code as a string instead of printing it out. Otherwise, it will return true. return

Voorbeeld: example

<?php
highlight_string('<?php phpinfo(); ?>');
?>
<code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php phpinfo</span><span style="color: #007700">(); </span><span style="color: #0000BB">?&gt;</span>
</span>
</code>
<pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php phpinfo</span><span style="color: #007700">(); </span><span style="color: #0000BB">?&gt;</span></code></pre>

The HTML markup generated is subject to change.

highlight_fileHighlighting INI directives