show_source() example.


show_source() example.

This is the example of show_source().

This is the example of show_source().


The show_source() function works similar to highlight_file () which displays a file with the PHP syntax highlighted. The syntax is highlighted by using HTML tags. This function returns TRUE on success, or FALSE on failure.



Path to the PHP file to be highlighted.


Set this parameter to TRUE to make this function return the highlighted code

show_source (filename, return)

Note: This function displays the entire file including passwords and any other sensitive information, so be cautious in using this function. 

Example: In the below example, we have used form action file for highlighting the source file.

<form action="<?php print $PHP_SELF ?>" method="get">

Enter file name:
<input type="text" name="file" value="<?php print $file; ?>">

if ( isset( $file ) )
show_source( $file ) or print "can not be open \"$file\"";