note 106329 deleted from function.register-shutdown-function by danbrown

From: Date: Fri, 28 Oct 2011 14:41:38 +0000
Subject: note 106329 deleted from function.register-shutdown-function by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-184193@lists.php.net to get a copy of this message
Note Submitter: northhero at gmail dot com ---- A little modification To dcez`s measuring page generation time function.You should record the time inside the function instead of passing to it. <?php set_time_limit(0); function check_time($end = false){ global $start; //Need some global variable where we will ceep our start time list($msec, $sec) = explode(' ', microtime()); $result = bcadd($msec, $sec, 10); if(!$end){ $start = $result; register_shutdown_function('check_time', 'true'); //Function registrates itself only with some parametrs now }elseif($end){ $end = $result; echo '<br />Page was generated in '.bcsub($end, $start, 10).' seconds...<br />'; } } check_time(); //Caling our function once! ?>

« previous php.notes (#184193) next »