Jump to content

Page generation time


plutomed

Recommended Posts

I have the code and it works:

 

<?
$time = microtime();
$time = explode(" ", $time);
$time = $time[1] + $time[0];
$start = $time;

//Page code

$time = microtime();
$time = explode(" ", $time);
$time = $time[1] + $time[0];
$finish = $time;
$totaltime = ($finish - $start);

?>

I was wondering if I could echo the gen. time halfway down the page, would it be posible?

Link to comment
https://forums.phpfreaks.com/topic/61642-page-generation-time/
Share on other sites

<?php
$time = microtime();
$time = explode(" ", $time);
$time = $time[1] + $time[0];
$start = $time;

//Page code

$time = microtime();
$time = explode(" ", $time);
$time = $time[1] + $time[0];
$finish = $time;
$totaltime = ($finish - $start);
echo $totaltime;

// more code.

$time = microtime();
$time = explode(" ", $time);
$time = $time[1] + $time[0];
$finish = $time;
$totaltime = ($finish - $start);
echo $totaltime;

?>

Link to comment
https://forums.phpfreaks.com/topic/61642-page-generation-time/#findComment-306838
Share on other sites

This is the code I am using...

 

I have this in the header:

// Load time stuff
$time = microtime();
$time = explode(" ", $time);
$time = $time[1] + $time[0];
$start = $time;

 

Then in my footer I have:

$time = microtime();
$time = explode(" ", $time);
$time = $time[1] + $time[0];
$finish = $time;
$totaltime = ($finish - $start);
//printf ("Page created in %f seconds with %g queries.", $totaltime, $num_queries);
if ($show_footertime == '1') {
printf ("Page created in %f seconds.", $totaltime); 

 

It works for me.  ???

 

Link to comment
https://forums.phpfreaks.com/topic/61642-page-generation-time/#findComment-306949
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.