Change language

PHP highlight_file () function

Syntax:
highlight_file ($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 and boolean parameter. Its default value is - FALSE. If set to TRUE, instead of printing it, this function will return the highlighted code as a string.
Return Value:returns TRUE on success or FALSE on failures. If $return is TRUE, it will return the highlighted code as a string.Notes :
  • This function is available in PHP 4.0.0 and newer version.
  • The colors 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.
Example 1.Save this code using the name server.php and run the program.
 
highlight_file ( "engineer.php" ) ; ?>  
< / html >
Output: Example 2:Save this code using the name engineer. php . < tbody>  
// Load XML document into $user $user = < < < XML < user > < username > Username < / username > < name > Firstname Lastname < / name > + 91-9876543210 < / phone > < detail font-color = "blue" font = "awsome-fonts" font-size = "24px" > Noida, India < / detail > < / user >
XML;  
// Load the string as a simple xml object $xml = simplexml_load_string ( $user );  
// Print children foreach ( $xml -> children() as $child ) { echo "child node:" . $child . "
"
; }  
?>
Use the above filename in the program below to highlight syntax.
 
highlight_file ( "engineer.php" ) ; ?>  
< / html >
Output: Link: https://php.net/manual/en/function.highlight-file.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