public static function drawTable($rows)
    {
        $pad = array();

        foreach ($rows as $row) {
            foreach ($row as $k => $v) {
                if (substr($k, 0, 1) == '_') {
                    continue;
                }

                if (
                    !isset($pad[$k])
                    || (strlen($v) > $pad[$k])
                ) {
                    $pad[$k] = strlen($v);
                }
            }
        }

        foreach ($rows as $row) {
            if (isset($row['_color'])) {
                self::setStyle($row['_color']);
            }

            if (isset($row['_bold'])) {
                self::setStyle('1');
            }

            if (isset($row['_'])) {
                echo $row['_'];
            } else {
                $i = 0;

                foreach ($row as $k => $v) {
                    if (substr($k, 0, 1) == '_') {
                        continue;
                    }

                    if ($i > 0) {
                        echo "\t";
                    }

                    echo str_pad($v, $pad[$k]);
                    ++$i;
                }
            }

            self::resetStyle();
            echo "\n";
        }
    }
public static function drawTable($rows)
    {
        $pad = array();

        foreach ($rows as $row) {
            foreach ($row as $k => $v) {
                if (substr($k, 0, 1) == '_') {
                    continue;
                }

                if (
                    !isset($pad[$k])
                    || (strlen($v) > $pad[$k])
                ) {
                    $pad[$k] = strlen($v);
                }
            }
        }

        foreach ($rows as $row) {
            if (isset($row['_color'])) {
                self::setStyle($row['_color']);
            }

            if (isset($row['_bold'])) {
                self::setStyle('1');
            }

            if (isset($row['_'])) {
                echo $row['_'];
            } else {
                $i = 0;

                foreach ($row as $k => $v) {
                    if (substr($k, 0, 1) == '_') {
                        continue;
                    }

                    if ($i > 0) {
                        echo "\t";
                    }

                    echo str_pad($v, $pad[$k]);
                    ++$i;
                }
            }

            self::resetStyle();
            echo "\n";
        }
    }
public static function drawTable ( $ rows ) { $ pad = array ( ) ; foreach ( $ rows as $ row ) { foreach ( $ row as $ k => $ v ) { if ( substr ( $ k , 0 , 1 ) == '_' ) { continue ; } if ( ! isset ( $ pad [ $ k ] ) || ( strlen ( $ v ) > $ pad [ $ k ] ) ) { $ pad [ $ k ] = strlen ( $ v ) ; } } } foreach ( $ rows as $ row ) { if ( isset ( $ row [ '_color' ] ) ) { self :: setStyle ( $ row [ '_color' ] ) ; } if ( isset ( $ row [ '_bold' ] ) ) { self :: setStyle ( '1' ) ; } if ( isset ( $ row [ '_' ] ) ) { echo $ row [ '_' ] ; } else { $ i = 0 ; foreach ( $ row as $ k => $ v ) { if ( substr ( $ k , 0 , 1 ) == '_' ) { continue ; } if ( $ i > 0 ) { echo "\t" ; } echo str_pad ( $ v , $ pad [ $ k ] ) ; ++ $ i ; } } self :: resetStyle ( ) ; echo "\n" ; } }
Draw a table
@param array Array of table's rows.
@return void
Draw a table