Change language

PHP Show_source () function

Syntax:
show_source ($filename, $return) 
Parameters:This function takes two parameters as specified above and described below:
  • $filename:required. It specifies the file whose contents will be displayed.
  • $return:This is an optional boolean parameter. Its default value is - FALSE. If set to TRUE, this function will return the highlighted code as a string instead of printing it.
Return Value:if set to TRUE, it returns highlighted code as a string. It will return TRUE on success or FALSE on error.Notes :
  • This function is available for PHP 4.0.0 and newer .
  • The color used for PHP syntax highlighting can be set using the ini_set() function or in the php.ini file.
  • This function will display the entire file, which may include sensitive data such as passwords, etc.
The following programs illustrate the show_source() function in PHP:Program 1:Below programs save the file using filename show_source.php

show_source ( " show_source.php " ); ?>

< / html >
Output: Program 2:Below the program, save the file using the filename source_code.php  
// Load the XML document into $user $user = < < < XML < user > < username > Geeks123 < / username > < name > GeeksforGeeks < / name > + 91-XXXXXXXXXX < / phone > < detail font-color = "blue" font-size = "24px" > Noida, India < / detail > < / user >
XML;  
// Load the string as a simple xml object $xml = simplexml_load_string ( $user );  
// Print child foreach ( $xml -> children() as $child ) { echo "child node:" . $child . "
"
; }  
?>
main.php


show_source ( " source_code.php " ); ?>

< / html >
Output: Link: https://www.php.net/manual/en/function.show-source.php

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method