Easy Tutorial
❮ Php Imagecreate Func Math Sqrt ❯

PHP show_source() Function

PHP Misc Reference Manual

Example

Highlight PHP syntax for a test file ("test.php"):

The browser output of the above code is as follows (depending on the content of the file):

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


Definition and Usage

The show_source() function highlights PHP syntax for a file. Syntax highlighting is achieved using HTML tags.

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

show_source() is an alias of highlight_file().

Note: When using this function, the entire file, including passwords and other sensitive information, will be displayed!


Syntax

Parameter Description
filename Required. Specifies the file to display.
return Optional. If 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: If the return parameter is set to TRUE, the function will return the highlighted code as a string instead of outputting it directly. Otherwise, it returns TRUE on success or FALSE on failure.
PHP Version: 4+
--- ---
Changelog: Since PHP 4.2.1, this function is also affected by safe_mode and open_basedir. However, safe_mode was removed in PHP 5.4. <br> <br>The return parameter was added in PHP 4.2.0.
--- ---
❮ Php Imagecreate Func Math Sqrt ❯