I use the same to see if a file was uploaded, may not be the best, but it
works.
a simple class that I include works just as well as yours but it gives 4
decimal places on the seconds. one simple line.
$debug->time();
$debug->time('finnishing while statement');
<?php
function mtime()
{
$mtime = microtime();
$mtime = str_replace('.', '', $mtime);
$mtime = explode(' ', $mtime);
$mtime = $mtime[1] . $mtime[0];
return($mtime);
}
class debug
{
function debug()
{
$this->start = mtime();
}
function reset()
{
$all_vars = get_object_vars($this);
foreach($all_vars as $pos => $val)
if ($pos != 'error')
unset($this->$pos);
}
function time($text = '')
{
$this->break = mtime();
$time = ($this->break - $this->start) / 1000000000;
echo number_format($time, 4) .' '. $text ."<br>\n";
$this->start = $this->break;
}
}
$debug = new debug;
?>
--
Chris Lee
Mediawaveonline.com
em. [EMAIL PROTECTED]
ph. 250.377.1095
ph. 250.376.2690
fx. 250.554.1120
""Matt"" <[EMAIL PROTECTED]> wrote in message
003f01c09cbc$274b39c0$64019998@mattt">news:003f01c09cbc$274b39c0$64019998@mattt...
Hi,
I wondered if anyone knew what would be the better method to use to see if a
file has been sent/uploaded?
method 1:
if ($HTTP_POST_FILES['file']['name'] != "none" && $HTTP_POST_FILES['file']
!= "") {
method 2:
if (@$fp = fopen($HTTP_POST_FILES['file']['tmp_name'],"r")) {
method 2 seems to work better, and seeing as I have to open the file on the
next line testing to see if its there seemed the better way to do it?
How can I find out how long my scripts take to execute?
I'm currently using..
$stimer = timer();
// code ......
$etimer = timer();
echo "\n\nPage processed in: ". ($etimer-$stimer);
Function timer() {
$milli = explode(" ", microtime());
return $milli[0];
}
Which works but is their a better way to do it?
Thanks,
Matt
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]