News Feed
Sections




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

Phil Sturgeon's Blog:
Power dump() on your PHP applications
September 30, 2010 @ 11:04:03

Phil Sturgeon has a quick new post with a code snippet that could make your debugging life a bit simpler - a "dump" function that can give you a bit more information about your error than a standard var_dump.

When trying to work out what the hell is going wrong in your PHP application the first thing most of us start doing is madly start var_dump()'ing everything possible to work out where the problem is. var_dump() is fine, but by default it comes out in one line. So then we need to echo <pre> tags. Then we can't always see whats going on, especially if the background is black and bla bla bla so it goes on.

He mentions an alternative like XDebug, but that also requires access to install it on the server. His alternative, the "dump" function, catches the error, pulls out a backtrace of the path your script took to get there and echoes it out with the line number of the error and filename.

1 comment voice your opinion now!
debug snippet vardump backtrace


blog comments powered by Disqus

Similar Posts

Davey Shafik's Blog: Debugging from Firefox with xdebug and Komodo

Designer Daily: 8 useful recipes to improve your WordPress theme

DevShed: Working with the XDebug extension's var_dump() function

Tony Lukasavage's Blog: PHP Debugging on IntelliJ IDEA 10 with Xdebug

JetBrains.com: Just-In-Time debugging and PHP Exception Breakpoints with PhpStorm and Xdebug


Community Events





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


podcast symfony version interview introduction unittest threedevsandamaybe list configure opinion voicesoftheelephpant series framework language laravel api conference composer release community

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