Created
February 26, 2014 17:25
-
-
Save openam/9234221 to your computer and use it in GitHub Desktop.
A simple PHP debug function, similar to CakePHP
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 | |
| /** | |
| * debug is a simple function to show which line and file a debug call came from | |
| * including the contents of print_r() wrapped in a <pre> tag | |
| * | |
| * @param string $value | |
| * @return void | |
| */ | |
| function debug($value = '') { | |
| $backtrace = debug_backtrace(); | |
| echo '<h5>' . $backtrace[0]['file'] . ' - Line: ' . $backtrace[0] ['line'] . '</h5>'; | |
| echo "<pre>"; print_r($value); echo "</pre>"; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment