PHP | show_source() Function Last Updated : 03 Jul, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report 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. Syntax: 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. Note: 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 php <html> <body> <?php show_source("show_source.php"); ?> </body> </html> Output: Program 2: Below program save the file using file name source_code.php php <?php // Loading XML document to $user $user = <<<XML <user> <username>Geeks123</username> <name>GeeksforGeeks</name> <phone>+91-XXXXXXXXXX</phone> <detail font-color="blue" font-size="24px"> Noida, India </detail> </user> XML; // Loading string as simple xml object $xml = simplexml_load_string($user); // Printing children element foreach($xml->children() as $child) { echo "child node:" . $child . "</br>"; } ?> main.php php <!DOCTYPE html> <html> <body> <?php show_source("source_code.php"); ?> </body> </html> Output: Reference: https://www.php.net/manual/en/function.show-source.php Comment More infoAdvertise with us Next Article PHP get_resource_type() Function G gekcho Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP get_resources() Function The get_resources() function is an inbuilt function in PHP that returns active resources in an array form, & optionally, the resource type will be filtered. Syntax: array get_resources(?string $type = null)Parameters: This function accepts one parameter that is described below: type: This parame 1 min read PHP get_resource_id() Function The get_resource_id() function is an inbuilt function in PHP that returns the integer id given resource. This function provides a safe way of generating integers for a resource. Syntax: get_resource_id($resource) ;Parameters: This function accepts one parameter that are described below: $resource: 1 min read PHP get_resource_type() Function The get_resource_type() function is an inbuilt function in PHP that is used for returning the type of resource. Syntax: get_resource_type(resource $resource) Parameters: This function accepts one parameter that described below: $resource: This parameter specifies the evaluated resource handle name.R 1 min read PHP | print_r() Function The print_r() function is a built-in function in PHP and is used to print or display information stored in a variable. Syntax: print_r( $variable, $isStore ) Parameters: This function accepts two parameters as shown in above syntax and described below. $variable: This parameter specifies the variabl 2 min read PHP | time() Function The time() function is a built-in function in PHP which returns the current time measured in the number of seconds since the Unix Epoch. The number of seconds can be converted to the current date using date() function in PHP. Syntax: int time() Parameter: This function does not accepts any parameter 2 min read PHP | ob_start() Function Let's take a quick recap. PHP is an interpreted language thus each statement is executed one after another, therefore PHP tends to send HTML to browsers in chunks thus reducing performance. Using output buffering the generated HTML gets stored in a buffer or a string variable and is sent to the buff 2 min read Like