php print_r nice table

前端 未结 4 731
失恋的感觉
失恋的感觉 2021-02-08 02:46

I\'m looking to be able to produce a nicely formatted table with rows and columns from the contents of a print_r array statement?

Any ideas?

4条回答
  •  遥遥无期
    2021-02-08 03:26

    Try this out, could be improved but it works.

    function myprint_r($my_array) {
        if (is_array($my_array)) {
            echo "";
            echo '';
            foreach ($my_array as $k => $v) {
                    echo '";
            }
            echo "
    ARRAY
    '; echo '' . $k . ""; myprint_r($v); echo "
    "; return; } echo $my_array; }

提交回复
热议问题