Skip to content

Instantly share code, notes, and snippets.

View joel-depiltech's full-sized avatar

Joël Gaujard joel-depiltech

View GitHub Profile
@hadl
hadl / microtime_diff.php
Last active March 5, 2021 04:05
PHP Microtime Diff -- Calculate a precise time difference
<?php
/**
* Calculate a precise time difference.
* @param string $start result of microtime()
* @param string $end result of microtime(); if NULL/FALSE/0/'' then it's now
* @return flat difference in seconds, calculated with minimum precision loss
*/
function microtime_diff($start, $end = null)
{
if (!$end) {