We all use print_r from now to then in our code to quickly debug a statement. But it's easy to forget this and leave this in your code for unexperienced programmers. Sometimes it's in a conditional section and than it's very hard to keep track of these.
This information ruins your page and makes your clients very unhappy.
A better alternative is to use the dpr function, which is provided by the devel module. This function checks if a user has access to development information via a permission 'access devel information'.
And if you even want to top that off, do a function_exists to make sure you have devel installed (or some other module to provide this function).
$a = array('test');
if(function_exists('dpr')) dpr($a);
Comments
Post new comment