Skip to content

Instantly share code, notes, and snippets.

@corazzi
Last active May 13, 2016 15:10
Show Gist options
  • Save corazzi/2acf9626cb9e7e799d5130656b6d3128 to your computer and use it in GitHub Desktop.
Save corazzi/2acf9626cb9e7e799d5130656b6d3128 to your computer and use it in GitHub Desktop.
Echo out a step in your debugging trace to find out where your code is executed
<?php
function debug_step($message = '')
{
if (isset($_GET['debug'])) {
/**
* Count how many times the debug step has been called
* @var integer
*/
static $i = 1;
echo sprintf("<strong>%d:</strong> (%s) %s <br>", $i++, debug_backtrace()[1]['function'], $message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment