Needs help!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kaily
Forum Newbie
Posts: 12
Joined: Fri Jul 05, 2002 12:17 pm

Needs help!

Post by kaily »

Is it possible to get "how much time does the PHP script cost to run"?
Sorry for my english!
User avatar
martin
Forum Commoner
Posts: 33
Joined: Fri Jun 28, 2002 12:59 pm
Location: Cambridgeshire

Post by martin »

This should do the trick, just insert your script where indicated.

Code: Select all

function getmicrotime(){ 
    list($usec, $sec) = explode(" ",microtime()); 
    return ((float)$usec + (float)$sec); 
    } 

$time_start = getmicrotime();
    
//your code here

$time_end = getmicrotime();
$time = $time_end - $time_start;

echo "Did nothing in $time seconds";
Post Reply