Introduction
It all started some years ago when I had to debug some large
application written in endless spaghetti-code, and I started to use
print_r() and
var_dump() a lot.
The first drawback of using these plain functions was that you had to surround
them by <pre>. The second one was in my situation, that I
used them so much that I sometimes lost track of where I had put them, and eventually
I spent more time searching for the place where I had put in a print_r()
then actually debugging …
So I decided to write me a wrapper-function. I called it pre()
to resemble the HTML-Tag. There wasn't much about it, it simply printed the
<pre> and drew a border around it. Later the location
of the function-call and an additional function called
ex() were added to make it faster to exit script after the dump.
That was very helpful, but not extraordinary.
The misery started
when I had to work a lot with XML and DOM, and I got sucked by typing
pre($DOMDocument->saveXML()) every time I wanted to have a look
at the XML-code. So I extended my small function to handle
DOMDocument and DOMElement objects separately and call
saveXML() on them.
Then I thought it would be a good idea to have the XML highlighted. And then I wanted to have the highlighting on the normal dumps, too. And one day I was realy bored and I found myself writing code to display the actual PHP code that surrounded the function call – rather to prove to myself that I can than for thinking that would be too useful. But it remained in the code and sometimes I really like it.
That was about the time PHP 5.1 was released and I discovered the ReflectionAPI. It took me quite some time, but I did add a complete object reflection.
Since that time I did overriding improvements to usability (like those nice windows
you can move around) or architecture (like the API for dump plugins). Beside
writing some more plugins as I need them, the next big step will be the implementation
of deprec() to mark functions as deprecated and care about the
calling points if you have time.