Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f02f6fd
commit 80ab8c4
Showing
13 changed files
with
6,574 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
ajax loading while running code | ||
snipt.net or similar integration | ||
snipt.net or similar integration | ||
unit testing framework implementation | ||
php code coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
class timer | ||
{ | ||
private $start_time = NULL; | ||
private $end_time = NULL; | ||
|
||
private function getmicrotime() | ||
{ | ||
list($usec, $sec) = explode(" ", microtime()); | ||
return ((float)$usec + (float)$sec); | ||
} | ||
|
||
function start() | ||
{ | ||
$this->start_time = $this->getmicrotime(); | ||
} | ||
|
||
function stop() | ||
{ | ||
$this->end_time = $this->getmicrotime(); | ||
} | ||
|
||
function result() | ||
{ | ||
if (is_null($this->start_time)) | ||
{ | ||
exit('Timer: start method not called !'); | ||
return false; | ||
} | ||
else if (is_null($this->end_time)) | ||
{ | ||
exit('Timer: stop method not called !'); | ||
return false; | ||
} | ||
|
||
return round(($this->end_time - $this->start_time), 4); | ||
} | ||
|
||
# an alias of result function | ||
function time() | ||
{ | ||
$this->result(); | ||
} | ||
|
||
} | ||
|
||
?> |
Oops, something went wrong.