Home > PHP > Function > Misc. > highlight_string()

highlight_string()

highlight_string - Syntax highlighting of a string

Syntax

mixed highlight_string (string $str, bool $return)

Arguments

  • str - The PHP code to be highlighted. This should include the opening tag.
  • return - Set this parameter to TRUE to make this function return the highlighted code.

Description

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

Version

PHP 4, 5

Return value

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.