Q:

PHP: Embed debugging info in output?

Is there an easy way to get PHP to output a stack trace in an HTML comment everwhere it produces output? I am using xdebug, but being able to search through a massive dump would be helpful when I am placing breakpoints in the wrong place.

Hell is other people's code

A:

No direct way exists. 
Indirectly, you may include a DIV element in the target page:
<div id="debugInfo">
 ...
</div>

Fill the DIV with the debug info you'd like to know. 
Use CSS and JavaScript reduce the size of the DIV to e.g. 20 x 10 px by default. 
Using an onmousedown event, maximize the DIV element. On the next onmousedown event, reduce the size again.
In other words: Each click on the DIV element toggles its size.

