...

View Full Version : Explanation of code



SDP2006
03-22-2004, 11:17 PM
Could someone comment on this code and tell me what it does? [edit] I know what it does, but what exactly it is doing is what I need to know

I am using this code and I really like to understand what is going on in the code I use. Thanks


<?php
$stimer = explode(' ', microtime());
$stimer = $stimer[1] + $stimer[0];

$etimer = explode(' ', microtime());
$etimer = $etimer[1] + $etimer[0];
/* I know what is going on from here down */
echo "<center><font size='2'>";
printf("Page rendered in <b>%f</b> seconds", $etimer-$stimer);
echo '</center></font>';
?>

Thanks to all

Nightfire
03-22-2004, 11:35 PM
See http://www.php.net/microtime and http://www.php.net/explode


<?php
// splits the time at the space
$stimer = explode(' ', microtime());
// Puts the times together (seconds and milliseconds)
$stimer = $stimer[1] + $stimer[0];

// Does exactly the same as above
$etimer = explode(' ', microtime());
$etimer = $etimer[1] + $etimer[0];

/* I know what is going on from here down */
echo "<center><font size='2'>";
printf("Page rendered in <b>%f</b> seconds", $etimer-$stimer);
echo '</center></font>';
?>

SDP2006
03-23-2004, 12:06 AM
Thats simple enough, thanks Nightfire :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum