note 54596 deleted from function.microtime by betz
| From: | betz@php.net | Date: | Fri, 08 Jul 2005 17:32:41 +0000 |
| Subject: | note 54596 deleted from function.microtime by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-91695@lists.php.net to get a copy of this message | ||
Note Submitter: Helpful Harry
Reason: bad code
----
eval script with microtime_float()
<html>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>"
method="POST">
<textarea name="exec" rows="8" cols="60"><?php echo
htmlspecialchars($_POST['exec']); ?></textarea>
<br><br>
<input type="submit" value="Exec...">
</form>
<br>
<pre>
<?php
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
echo "--------------------------------------------------------\n\n";
$begin_timestamp = microtime_float();
eval(html_entity_decode($_POST['exec']));
$end_timestamp = microtime_float();
echo "\n\n--------------------------------------------------------\n";
echo '<b>Execution Time: '.($end_timestamp - $begin_timestamp).'
Seconds</b>';
}
?>
</pre>
</body>
</html>