Easy Tutorial
❮ Php Forms Func String Strnatcasecmp ❯

PHP highlight_string() Function

PHP Misc Reference Manual

Example

Highlight PHP syntax for a string:

The browser output of the above code is as follows:

The HTML output of the above code is as follows (view source):


Definition and Usage

The highlight_string() function highlights PHP syntax for a string. The string is highlighted using HTML tags.

The colors for highlighting can be set via the php.ini file or by calling the ini_set() function.


Syntax

Parameter Description
string Required. Specifies the string to be highlighted.
return Optional. If this parameter is set to TRUE, the function will return the highlighted code as a string instead of outputting it directly. The default is FALSE.

Technical Details

Return Value: Returns TRUE on success, FALSE on failure.
PHP Version: 4+
--- ---
Changelog: The return parameter was added in PHP 4.2.0.
--- ---

❮ Php Forms Func String Strnatcasecmp ❯