Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<__halt_compilerhighlight_string>
Last updated: Tue, 19 Sep 2006

highlight_file

(PHP 4, PHP 5)

highlight_file -- Syntax highlighting of a file

Description

mixed highlight_file ( string filename [, bool return] )

The highlight_file() function prints out a syntax highlighted version of the code contained in filename using the colors defined in the built-in syntax highlighter for PHP.

If the second parameter return is set to TRUE then highlight_file() will return the highlighted code as a string instead of printing it out. If the second parameter is not set to TRUE then highlight_file() will return TRUE on success, FALSE on failure.

Note: This function internally uses the output buffering with this parameter so it can not be used inside ob_start() callback function.

Note: The return parameter became available in PHP 4.2.0. Before this time it behaved like the default, which is FALSE

Note: Since PHP 4.2.1 this function is also affected by safe_mode and open_basedir.

Caution

Care should be taken when using the highlight_file() function to make sure that you do not inadvertently reveal sensitive information such as passwords or any other type of information that might create a potential security risk.

Many servers are configured to automatically highlight files with a phps extension. For example, example.phps when viewed will show the syntax highlighted source of the file. To enable this, add this line to the httpd.conf:

AddType application/x-httpd-php-source .phps

See also highlight_string().




<__halt_compilerhighlight_string>
Last updated: Tue, 19 Sep 2006