Last active
May 13, 2016 15:10
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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