Stuff
public php v1 · immutable<?php class Benchmark { var $marks = array(); function mark($name) { $this->marks[$name] = microtime(); } function calculate( $aName, $bName='', $decimals=4) { $aTime = $this->marks[$aName]; $bTime = $this->marks[$bName]; if (!isset($aTime)) { return ''; } if (!isset($bTime)) { $bTime = microtime(); } list($sm, $ss) = explode(" ", $aTime); list($em, $es) = explode(" ", $bTime); return number_format(($em + $es) - ($sm + $ss), $decimals); } }