PHP multidimensional array to plain text tree structure

Not for the first time I’ve searched for a way to visualize a multidimensional array in a tree view in my web browser without directly using echo or print. I wasn’t able to find a concrete solution for this previously. However, this time I was put on the right track by a post of Kevin van Zonneveld. I’ve given it my own (quick and dirty as can be seen from the code) twist to get it to work. By just calling:

print implode(ArrayFunctions::toString($array));

The array is shown as a tree structure on the screen.
The implementation is as follows:

Getagged ,

Één reactie op “PHP multidimensional array to plain text tree structure

  1. Shirly schreef:

    good stuff, thank you for posting.

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *