Skip to content

Instantly share code, notes, and snippets.

@otaavioo
Last active July 26, 2020 23:47
Show Gist options
  • Save otaavioo/791a27a97d110588f88e420c066d11f3 to your computer and use it in GitHub Desktop.
Save otaavioo/791a27a97d110588f88e420c066d11f3 to your computer and use it in GitHub Desktop.
Class to get elapsed time
<?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