PHP debug time response server
How to replace sleep(2), for your PHP code. Ideal testing hosting/dns ping.
Copy this code and paste it in your HTML
<?
if( !empty($_GET['clear']) ){ $_SESSION['tiempos'] = 0;
$_SESSION['tiempos_veces'] = 0;
header('location: '.$_SERVER['PHP_SELF']); }
$final = explode(" ", microtime()); $tiempo = ($final[1] + $final[0]) - ($comienzo[1] - $comienzo[0]);
echo 'This time generation ', number_format($tiempo,2), ' seconds';
$_SESSION['tiempos'] = $tiempo + (empty($_SESSION['tiempos'] )?
0:$_SESSION['tiempos']); $_SESSION['tiempos_veces'] = empty($_SESSION['tiempos_veces'])?
1:1+$_SESSION['tiempos_veces'];
?><br />
Count refresh: <?=$_SESSION['tiempos_veces'];?><br />
Average time:
<?=number_format($_SESSION['tiempos']/$_SESSION['tiempos_veces'],2);?> seconds.
<br />
<br />
<hr />
<a href="<?=$_SERVER['PHP_SELF'];?>?clear=1">Restar testing time</a>
Report this snippet
Comments
Subscribe to comments