The show_source() function is an inbuilt function in PHP which is used to return a file with the PHP syntax highlighted. The syntax is highlighted by using HTML tags.
show_source( $filename, $return )
Parameters: This function accepts two parameters as mentioned above and described below:
- $filename: It is required parameter. It specifies the file whose content to be display.
- $return: It is optional boolean parameter. Its default value is FALSE. If it is set to TRUE, instead of printing it out, this function will return the highlighted code as a string.
Return Value: If it is set to TRUE then it returns the highlighted code as string. It will return TRUE on success or return FALSE on failure.
- This function is available for PHP 4.0.0 and newer version.
- The color used for highlighting the PHP syntax can be set with the ini_set() function or in the php.ini file.
- With this function entire file will be displayed, that may include sensitive data like passwords etc.
Below programs illustrate the show_source() function in PHP:
Program 1: Below program save the file using file name show_source.php
Program 2: Below program save the file using file name source_code.php
- How to get the function name inside a function in PHP ?
- p5.js | red() function
- D3.js | d3.map.set() Function
- p5.js | sin() function
- PHP | pow( ) Function
- p5.js | cos() function
- p5.js | log() function
- D3.js | d3.set.has() Function
- p5.js | max() function
- p5.js | arc() Function
- PHP | pi( ) Function
- CSS | var() Function
- PHP | Ds\Map xor() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.