[ACCEPTED]-php print_r nice table-php

Accepted answer
Score: 75

Here is a very simple way to print pretty 1 arrays with html pre tag:

<?php
$myarray = array('a','b','c');
echo '<pre>';
print_r($myarray);
echo '</pre>';
?>
Score: 19

Your question is a bit vague, but did you 1 mean something like this:

http://dbug.ospinto.com/

dbug bar

Score: 13

Try this out, could be improved but it works.

function myprint_r($my_array) {
    if (is_array($my_array)) {
        echo "<table border=1 cellspacing=0 cellpadding=3 width=100%>";
        echo '<tr><td colspan=2 style="background-color:#333333;"><strong><font color=white>ARRAY</font></strong></td></tr>';
        foreach ($my_array as $k => $v) {
                echo '<tr><td valign="top" style="width:40px;background-color:#F0F0F0;">';
                echo '<strong>' . $k . "</strong></td><td>";
                myprint_r($v);
                echo "</td></tr>";
        }
        echo "</table>";
        return;
    }
    echo $my_array;
}

0

More Related questions