/ Published in: PHP
This class is useful to debug your code. I often use the debug function because i can find where my debug messages are.
I hope my function helps!
Expand |
Embed | Plain Text
class Dbg{ /** Short hand for print_r exit; **/ public function prd($d){ if(!self::$_mode) return; echo '<pre>'; echo '</pre>'; exit; } /** shorthand for print_r with pre **/ if(!self::$_mode) return; echo '<pre>'; echo '</pre>'; } /** * shorthand print_r with backtrace */ if(!self::$_mode) return; $file = 'undefined'; $line = 'undefined'; if($countTrace == 1){ $line = $backtraceInfo[0]['line']; $file = $backtraceInfo[0]['file']; } elseif($countTrace){ $line = $backtraceInfo[$countTrace -2]['line']; $file = $backtraceInfo[$countTrace -2]['file']; } echo '</pre></div>'; } }
Comments
Subscribe to comments
You need to login to post a comment.

There are only 3 little functions but i think the can be really useful.
There are only 3 little functions but i think the can be really useful.