Last Updated: February 25, 2016
· wkjagt

Discoverable pretty print (PHP)

When debugging something in many files, you can have a lot of print_r's and it can be hard to find all of them when you're done debugging. I made myself a shortcut in ST2 that gives me the following line:

echo '<pre>file: '.__FILE__."\nline: ".__LINE__."\n".print_r(, true).'</pre>';

It also places the cursor at the first argument position of the print_r.

This will not only output your variable in a pretty way, but also the location of the line number and file name of where I put the line.

Say Thanks