PHP highlight_file() Function
Complete PHP Misc Reference
Definition and Usage
The highlight_file() function outputs a file with the PHP syntax
highlighted. The syntax is highlighted by using HTML tags.
The colors used for highlighting can be set in the php.ini file or with the ini_set() function.
This function returns TRUE on success, or FALSE on failure.
Syntax
highlight_file(filename,return)
|
Parameter |
Description |
filename |
Required. Specifies the file to display |
return |
Optional. If this parameter is set to TRUE, this function will return
the highlighted code as a string, instead of printing it out. Default is
FALSE |
Tips and Notes
Note: When using this function, the entire file will be displayed - including passwords and any other
sensitive information!
Example
"test.php":
<html>
<body>
<?php
highlight_file("test.php");
?>
</body>
</html> |
The output of the code above could be:
<html>
<body>
<?php
highlight_file("test.php");
?>
</body>
</html>
|
and, if you select "View source" in the browser window, it will look
something like this:
<html>
<body>
<code>
<span style="color: #000000"><html>
<br />
<body>
<br />
<span style="color: #0000BB"><?php
<br />highlight_file</span>
<span style="color: #007700">(</span>
<span style="color: #DD0000">"test.php"</span>
<span style="color: #007700">);<br /></span>
<span style="color: #0000BB">?><br /></span>
</body>
<br />
</html></span>
</code>
</body>
</html>
|
Complete PHP Misc Reference
Make your web applications look like a million bucks
|
|
Most web applications today use boring methods to present data to their viewers using grids or simple HTML tables. FusionCharts induces "life" into the web applications by converting monotonous data into lively charts, gauges & maps.
FusionCharts works with all technologies like ASP, ASP.NET, PHP, ColdFusion, Ruby on Rails, JSP, HTML pages etc.
and connects to any database to render animated & interactive charts. It takes less than 15 minutes and no expertise
whatsoever to build your first chart and just a glance of it to captivate your audience. This fact is endorsed by our
12,000 customers and 150,000 users which include a majority of the Fortune 500 companies.
And yeah, your applications could look like a million bucks by spending just $69.
So go ahead, download your
copy of FusionCharts and start "wow-ing" your customers now!
|
|