phpdebugging

PHP: How do I print out debugging information without breaking HTML or CSS?


Just wondering -

When debuging PHP - how do you like to output the test data to see whats going on? I've been noticing that a lot of my PHP echo testing is screwing with my CSS. Does anyone have a good clean method of seeing the results without screwing with the site itself?


Solution

  • You should try error_log function. It will log your debug output directly into the web server logs, and not in your page.

    Another way is to echo between comments markups:

    echo '<!-- This is a debug message! -->';