Skip to content

Instantly share code, notes, and snippets.

@Pegasuz
Forked from thomascrepain/Global Debug Function
Last active August 29, 2015 14:21
Show Gist options
  • Save Pegasuz/f852a4bd85c8c580082e to your computer and use it in GitHub Desktop.
Save Pegasuz/f852a4bd85c8c580082e to your computer and use it in GitHub Desktop.
function debug($msg, $exit = true)
{
if ($_SERVER['REMOTE_ADDR'] == '127.0.0.1') { // Only from my IP
echo "<pre>";
print_r($msg);
echo "</pre>";
$calledFrom = reset(debug_backtrace());
echo "<br>Called from " . $calledFrom['file'] . ' | line ' . $calledFrom['line'] . "<br>";
echo "<hr>";
if ($exit) {
exit;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment