Return to Snippet

Revision: 60220
at October 26, 2012 01:38 by o0110o

Initial Code
// display source code
$lines = file('');
foreach ($lines as $line_num => $line) { 
	// loop thru each line and prepend line numbers
	echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br>\n";

Initial URL

Initial Description
Want to be able to display the source code of any webpage, with line numbering? Here is a simple code snippet to do it. Just modify the url on line 2 at your convenience. Or even better, make a pretty function according to your needs.

Initial Title
Display the source code of a webpage.

Initial Tags
php, code

Initial Language