<?php addcheck('fim'); return; echo '<div style="position:fixed; top:0px; width:20%; left:40%; right:40%; background:white; text-align:left; padding:10px; z-index:999999; font-family:Verdana; font-size:12px">'; foreach ($CHECKPOINTS as $check) { if (isset($check['end'])) { $total_time = round($check['end'] - $check['start'], 4); echo "{$check['codigo']}: {$total_time} seconds<br/>"; } } echo '</div>';
<?php $CHECKPOINTS = array(); function addcheck($codigo) { $time = microtime(); $time = explode(' ', $time); $time = $time[1] + $time[0]; $start = $time; $row = array('codigo' => $codigo, 'start' => $start); $lastid = count($GLOBALS['CHECKPOINTS']) - 1; if ($lastid >= 0) { $GLOBALS['CHECKPOINTS'][$lastid]['end'] = $row['start']; } $GLOBALS['CHECKPOINTS'][] = $row; } addcheck('PAGE LOAD');