show_source() example.


 

show_source() example.

This is the example of show_source().

This is the example of show_source().

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.

Parameters

filename

Path to the PHP file to be highlighted.

return

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

Syntax
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.

<html>
<head>
</head>
<body>
<form action="<?php print $PHP_SELF ?>" method="get">

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

<?php
if ( isset( $file ) )
show_source( $file ) or print "can not be open \"$file\"";
?>
</body>
</html>

Ads