Seeking open source or LGPL replacement for var_dump()
Before I code my own ... I have tried all the code in the PHP manual and not of it is very good. I have Gogoled for hours, but tend to find only GPL code, which can't be included in a commercial product (I'm j开发者_如何学Cust a guy trying to make a few bucks on the side, not working for a mega-corporation which could develop or buy code).
Things like Krumo look very good, but are actually too sophisticated for me. For instance, I don't want to click to expand, since I want to use the code in my error page and have the user copy/paste it into an email or print it out & fax it.
What I want is table dump, recursed, preferably with variable type as well as value and a count of array members (maybe string lengths too). Something static, simple and straightforward, which will mostly be used to dump $_SESSION on the error page (oh, and a nicely formatted stack trace would be nice too ;-)
Update: Please, standalone code only; nothing that is part of a framework. Thanks.
You are looking for Zend.
Zend_Debug::dump($data);
neatly prints out your data including arrays.
http://framework.zend.com/manual/en/zend.debug.dumping.html
Regarding the commercial usage, you can.
Check the last point in this answer - https://stackoverflow.com/questions/57773/zend-php-framework/257261#257261
Regarding the usage of this method as a standalone without the entire Zend Framework, you can.
Check the second point here - http://en.wikipedia.org/wiki/Zend_Framework#Features
Maybe this will be any good for you -> http://kohanaframework.org/3.1/guide/api/Debug
精彩评论