Page Loading Speed

Written by @m_k_amin 22 December 2012

This is a simple script that calculates the speed time of the page loading. If you have a search engine in your site, or you want to show the speed of your site to the users, this code is suitable for you. Just put the two PHP codes at beginning and end of your page. Enjoy!

Code Snippet:

                                                
                                                <!-- this script is provided by https://www.phpfreecode.com coded by: Kerixa Inc. -->
<!-- This Script is from www.hawkee.com, found at www.phpfreecode.com-->
<?php
$t1 = microtime(true); 
?>

<html>
<head>
</head>

<body>
<div style="text-align: center">
	<span style="font-size: 15pt; font-family: 'Times New Roman', Times, serif; color: #0D4689">The Main Body of your Site.</span><br style="font-size: 15pt; font-family: 'Times New Roman', Times, serif; color: #890D0D">
</div>
</body>
</html>

<?php
$t2 = microtime(true); 
$t=round($t2-$t1,5);
echo "<p align='center'><span style='font-size: 15pt; color: #890D0D'>The page is loaded in $t sec</span></p>";
?>
<div style="text-align: center; height: 15px">
	<font face="Tahoma"><a target="_blank" href="http://www.phpfreecode.com/">
	<span style="font-size: 8pt; text-decoration: none">PHP Free Code</span></a></font></div>
<a target='_blank' href='https://www.phpfreecode.com' style='font-size: 8pt; text-decoration: none'>Php Best Codes</a>                                                
                                            

Example:


About @m_k_amin

This user is pending a biography.

M

Comments


Here you can leave us commments. Let us know what you think about this code tutorial!

0 / 300

TRENDING POST
1
2
3
4
5
VISITORS
Online Users: 12
Recent Members: grkkid, Manaakividuinfo.com, karticksv, sava, tinatina
advertisement 2