Quick Tip: are you using pr()?

Tuesday, 1 September 2009 12:43 , In , ,

pr() is a version of print_r() with <pre> tags wrapped around it. It will echo out your array in a human-readable format - without having to view source.

Why is this useful? Well, in the world of CakePHP, everything is an array and eventually you're going to have to do some debugging. Not only is pr() easier to type, it's

Why doesn't pr() work?



Have you set debug mode to zero?

Check your /app/config/core.php for this line:

Configure::write('debug', 0);


Change it to:

Configure::write('debug', 2);


And now you should get some nice debug output at the bottom of every page too.