How can I format (pretty print) a multi-dimensional array for debugging? -
i've seen online pretty print modules code. know of 1 format multi-dimensional array readable display?
example, translate this:
array(83) { [0]=> array(2) { ["name"]=> string(11) "ce2 options" ["type"]=> string(5) "title" } [1]=> array(1) { ["type"]=> string(4) "open" } [2]=> array(5) { ["name"]=> string(8) "template" ["desc"]=> string(638) "test description" ["id"]=> string(9) "my_theme" ["type"]=> string(14) "selecttemplate" ["options"]=> array(13) {
into this...
array(83) { [0]=> array(2) { ["name"]=> string(11) "my options" ["type"]=> string(5) "title" } [1]=> array(1) { ["type"]=> string(4) "open" } [2]=> array(5) { ["name"]=> string(8) "template" ["desc"]=> string(638) "test description" ["id"]=> string(9) "my_theme" ["type"]=> string(14) "selecttemplate" ["options"]=> array(13) { [0]=> string(10) "test"
if want nicer output var_dump , check out alternatives listed here:
a more pretty/informative var_dump alternative in php?
particularily http://krumo.sourceforge.net/ provides more accessible dhtml view variable dumps. (it requires include() though.)
and if want keep generated output static html, might have write smallish wrapper script.
Comments
Post a Comment