- microtime: documentation ( source)
- rand: documentation ( source)
<?php
$inizio = microtime(true);
echo '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Home</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="./style.css" rel="stylesheet" type="text/css" />
</head>
<body>';
$rows = 20;
$cols = 10;
$x = 1;
$sum=0;
echo "<table>\n";
for($tr=1;$tr<=1000;$tr++){
for($td=1;$td<=400;$td++){
$x++;
$temp=((($td*$tr)+$x)+(rand(-1000, 1000))+($x/$tr))/($x*$x);
}
$sum+=$temp;
}
for($tr=1;$tr<=$rows;$tr++){
echo "<tr> ";
for($td=1;$td<=$cols;$td++){
$x++;
echo "<th> ".$tr.$td." </th> ";
}
echo "</tr>\n";
}
echo "</table>\n";
echo "<p>\n";
echo "<br />\n<br />\n<br />\n";
echo $sum."\n";
echo "<br />\n<br />\n<br />\n Tempo esecuzione: ";
echo $tempo = microtime(true) - $inizio."\n
</p>\n
</body>\n
</html>";
?>