DEV Community

Cover image for PHP features you use for debugging purposes ?
Carleii Dev
Carleii Dev

Posted on

PHP features you use for debugging purposes ?

What are the #PHP features you use for debugging purposes ?

  • Print_r()
  • var_dump()
  • assert()
  • debug_backtrace_*()

What else?

Top comments (5)

Collapse
 
codewithcaen profile image
CodeWithCaen

If in the Laravel ecosystem (and/or Symfony), the dump() and dd() helpers

Collapse
 
stephanie profile image
Stephanie Handsteiner

Just don't forget to remove the dd()/debug() calls before sending the PR off for review. ðŸĪŠ

Collapse
 
spo0q profile image
spO0q

The old print_r() is pretty convenient, so you may use like that:

echo "<pre>";
print_r($someVar);
echo "</pre>";
Enter fullscreen mode Exit fullscreen mode

It's definitely not the most modern way, but it works pretty much everywhere.

To go further, I recommend profiling the app with dedicated tools such as Blackfire. xdebug is really awesome for debugging too.

Collapse
 
tw2113 profile image
Michael Beckwith

XDebug

Collapse
 
carleii_dev profile image
Carleii Dev

Var_dump Always for me