PHP – Display HTML source with line numbers

The given php code helps you to get the source code in HTML format with line numbers.

Code Example: 

************** index.php **************
[/php]
<?php
// Get the HTML source of example
$count = file ('http://www.example.com/');
// Loop through our array
foreach ($count as $line_num => $line)
{
echo "Line #{$line_num} : " . htmlspecialchars($line) . "<br>\n";
}
?>
1

Post to Twitter Post to Digg Post to Facebook Post to Google Buzz Send Gmail

Leave a Reply

Your email address will not be published. Required fields are marked *

*