Jump to content

Counter in PHP

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
dirkfirst

dirkfirst

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 354 posts
How do I make a counter in PHP for execution time?

This script took: <time>

??

#2
Guest_chaganlal1_*

Guest_chaganlal1_*
  • Guests
If you are talking about page load time, this should help
http://www.pscode.co...Id=665&lngWId=8

#3
Guest_NeedHelp_*

Guest_NeedHelp_*
  • Guests
Here is a function I modified to do it:


// Determine start time

function slog_time() {

	$mtime = microtime();

	$mtime = explode(" ",$mtime);

	$mtime = $mtime[1] + $mtime[0];

	$starttime = $mtime; 

	

	// Return our time

	return $starttime;

}


// Determine end time

function elog_time($starttime) {

	$mtime = microtime();

   $mtime = explode(" ",$mtime);

   $mtime = $mtime[1] + $mtime[0];

   $endtime = $mtime;

   $totaltime = ($endtime - $starttime);

   

   // Return our display

   return $totaltime;


And then in your php do


// Get time in HEADER

$startTime = slog_time();


// Your php code here

.....................



// Get total time in FOOTER

$totalTime = elog_time($startTime);


// Display it

print "Execution Time: $totalTime Seconds<br />";




#4
falco85

falco85

    Programmer

  • Members
  • PipPipPipPip
  • 105 posts
Nice work n needhelp