src/Tag.php
public static function buildFromArray(&$html, $array, $tab = 0)
    {
        $pad = '';
        if ($tab > 0) {
            $pad = str_pad($pad, $tab * 2, ' ', STR_PAD_LEFT);
        }

        if (!isset($array[1])) {
            $html .= $array[0]."\n";

            return;
        }

        if (!empty($array[0])) {
            $html .= $pad;
            $html .= '<'.$array[0].$array[1].'>';
            $html .= "\n";
        }

        if (!empty($array[2])) {
            $html .= $pad.'  ';
            $html .= $array[2];
            $html .= "\n";
        }

        if (isset($array[3]) && is_array($array[3])) {
            foreach ($array[3] as $child_array) {
                self::buildFromArray($html, $child_array, $tab + 1);
            }
        }

        if (!empty($array[0])) {
            $html .= $pad;
            $html .= '</'.$array[0].'>';
            $html .= "\n";
        }
    }
public static function buildFromArray(&$html, $array, $tab = 0)
    {
        $pad = '';
        if ($tab > 0) {
            $pad = str_pad($pad, $tab * 2, ' ', STR_PAD_LEFT);
        }

        if (!isset($array[1])) {
            $html .= $array[0]."\n";

            return;
        }

        if (!empty($array[0])) {
            $html .= $pad;
            $html .= '<'.$array[0].$array[1].'>';
            $html .= "\n";
        }

        if (!empty($array[2])) {
            $html .= $pad.'  ';
            $html .= $array[2];
            $html .= "\n";
        }

        if (isset($array[3]) && is_array($array[3])) {
            foreach ($array[3] as $child_array) {
                self::buildFromArray($html, $child_array, $tab + 1);
            }
        }

        if (!empty($array[0])) {
            $html .= $pad;
            $html .= '</'.$array[0].'>';
            $html .= "\n";
        }
    }
public static function buildFromArray ( & $ html , $ array , $ tab = 0 ) { $ pad = '' ; if ( $ tab > 0 ) { $ pad = str_pad ( $ pad , $ tab * 2 , ' ' , STR_PAD_LEFT ) ; } if ( ! isset ( $ array [ 1 ] ) ) { $ html .= $ array [ 0 ] . "\n" ; return ; } if ( ! empty ( $ array [ 0 ] ) ) { $ html .= $ pad ; $ html .= '<' . $ array [ 0 ] . $ array [ 1 ] . '>' ; $ html .= "\n" ; } if ( ! empty ( $ array [ 2 ] ) ) { $ html .= $ pad . '  ' ; $ html .= $ array [ 2 ] ; $ html .= "\n" ; } if ( isset ( $ array [ 3 ] ) && is_array ( $ array [ 3 ] ) ) { foreach ( $ array [ 3 ] as $ child_array ) { self :: buildFromArray ( $ html , $ child_array , $ tab + 1 ) ; } } if ( ! empty ( $ array [ 0 ] ) ) { $ html .= $ pad ; $ html .= '</' . $ array [ 0 ] . '>' ; $ html .= "\n" ; } }
Build html from an array.

@param string &$html
@param array  $array
@param int    $tab

@return void
Build html from an array .