Last active
July 26, 2020 23:47
-
-
Save otaavioo/791a27a97d110588f88e420c066d11f3 to your computer and use it in GitHub Desktop.
Class to get elapsed time
This file contains hidden or 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
<?php | |
class microtime | |
{ | |
protected $microtime; | |
public function __construct() | |
{ | |
$this->microtime = $this->calcule(); | |
} | |
protected function calcule() | |
{ | |
$microtime = microtime(); | |
$microtime = explode(' ', $microtime); | |
return $microtime = $microtime[1] + $microtime[0]; | |
} | |
public function elapsed() | |
{ | |
return round($this->calcule() - $this->microtime, 2); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment