Share on Google+Share on Google+

show_source() example.

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\"";


Posted on: July 30, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.