Re: Variable Troubleshooting Code
| From: | Paul M Foster | Date: | Mon, 09 Jan 2012 21:15:40 +0000 |
| Subject: | Re: Variable Troubleshooting Code | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-316236@lists.php.net to get a copy of this message | ||
On Mon, Jan 09, 2012 at 10:42:59AM -0500, Marc Guay wrote:
> > some pretty natives php functions exists to do the job :
>
> But how many times in my life will I have write echo "<pre>"; ???
> Does anyone have a handy solution? (Make this the default behavior?
> Add a "even more human-readable" flag to the function? Create a
> simple macro in Aptana 3?)
I have an init file that I include in every site that contains a few
routines I use over and over. One such is:
function instrument($legend, $var)
{
print $legend . "<br/>\n";;
print "<pre><br/>\n";
print_r($var);
print "</pre><br/>\n";
}
I use this routine wherever I want to see what's going on. It formats
(particularly) array output so that I can read it, instead of having
everything look like JSON, which is much harder to read.
Feel free to use the above yourself as needed.
Paul
--
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com