News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Developer Tutorials:
Debugging PHP code using debug_backtrace
February 29, 2008 @ 10:27:00

On the Developer Tutorials blog today, Hasin Hayder has pointed out a handy PHP function that can make your debugging a bit less of a headache - debug_backtrace.

Most of the PHP developers debug php code in their local machine just by trial and error using "print_r","var_dump" and "echo". They don't write unit tests or follow any advanced debugger like xdebug. But the problem of using these methods is you cannot fool proof your code and their might be some bugs still present in your code.

He includes a simple example to show how it works and what kind of output it will give - a nested function call. Personally, I use this in some of my classes (like a database abstraction later) to track and see which functions my calls are coming from and what data they're sending me - easier to debug in one place than trying to guess.

0 comments voice your opinion now!
debugbacktrace debug example simple


blog comments powered by Disqus

Similar Posts

IBM developerWorks: Command-line PHP? Yes, you can!

Jani Hartikainen's Blog: Zend_Acl part 1: Misconceptions and simple ACLs

Padraic Brady's Blog: The PHPSpec Zend Framework App Testing Manifesto: ZF Integration

CodeSnipers.com: Caveman PHP Debugging

SitePoint PHP Blog: Useful in-browser development tools for PHP


Community Events

Don't see your event here?
Let us know!


application yii2 interview symfony list language series framework project opinion composer introduction part2 php7 testing api laravel example podcast community

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework