Skip to content

Instantly share code, notes, and snippets.

@postpostscript
Created March 2, 2016 15:27
Show Gist options
  • Save postpostscript/cfa03eed8db62d0b03bf to your computer and use it in GitHub Desktop.
Save postpostscript/cfa03eed8db62d0b03bf to your computer and use it in GitHub Desktop.
<?php
$profiles = array();
function profile_start($key) {
global $profiles;
$profiles[$key] = array();
$profiles[$key]["start"] = microtime(true);
}
function profile_end($key) {
global $profiles;
$profiles[$key]["end"] = microtime(true);
$profiles[$key]["value"] = $profiles[$key]["end"] - $profiles[$key]["start"];
}
function profile_val($key) {
global $profiles;
return $profiles[$key]["value"];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment