public static function grid ($value, $title = '', $maxDepth = 1, $excludeProps = [], $excludeEmpty = false,
                               $depth = 0)
  {
    if (is_null ($value) || is_scalar ($value))
      return self::toString ($value);
    if ($depth >= $maxDepth)
      return "<i>(...)</i>";

    if (is_object ($value)) {
      if (method_exists ($value, '__debugInfo'))
        $value = $value->__debugInfo ();
      else $value = get_object_vars ($value);
    }
    if ($title) $title = "<p><b>$title</b></p>";

    // Exclude some properties ($excludeProps) from $value.
    $value = array_diff_key ($value, array_fill_keys ($excludeProps, false));
    if ($excludeEmpty)
      $value = array_prune_empty ($value);

    return $value ? "$title<table class=__console-table><colgroup><col width=160><col width=100%></colgroup>
" . implode ('',
        map ($value, function ($v, $k) use ($depth, $maxDepth, $excludeProps, $excludeEmpty) {
          $v = self::grid ($v, '', $maxDepth, $excludeProps, $excludeEmpty, $depth + 1);
          return "<tr><th>$k<td>$v";
        })) . "
</table>"
      : '<i>[]</i>';
  }
public static function grid ($value, $title = '', $maxDepth = 1, $excludeProps = [], $excludeEmpty = false,
                               $depth = 0)
  {
    if (is_null ($value) || is_scalar ($value))
      return self::toString ($value);
    if ($depth >= $maxDepth)
      return "<i>(...)</i>";

    if (is_object ($value)) {
      if (method_exists ($value, '__debugInfo'))
        $value = $value->__debugInfo ();
      else $value = get_object_vars ($value);
    }
    if ($title) $title = "<p><b>$title</b></p>";

    // Exclude some properties ($excludeProps) from $value.
    $value = array_diff_key ($value, array_fill_keys ($excludeProps, false));
    if ($excludeEmpty)
      $value = array_prune_empty ($value);

    return $value ? "$title<table class=__console-table><colgroup><col width=160><col width=100%></colgroup>
" . implode ('',
        map ($value, function ($v, $k) use ($depth, $maxDepth, $excludeProps, $excludeEmpty) {
          $v = self::grid ($v, '', $maxDepth, $excludeProps, $excludeEmpty, $depth + 1);
          return "<tr><th>$k<td>$v";
        })) . "
</table>"
      : '<i>[]</i>';
  }
public static function grid ( $ value , $ title = '' , $ maxDepth = 1 , $ excludeProps = [ ] , $ excludeEmpty = false , $ depth = 0 ) { if ( is_null ( $ value ) || is_scalar ( $ value ) ) return self :: toString ( $ value ) ; if ( $ depth >= $ maxDepth ) return "<i>(...)</i>" ; if ( is_object ( $ value ) ) { if ( method_exists ( $ value , '__debugInfo' ) ) $ value = $ value -> __debugInfo ( ) ; else $ value = get_object_vars ( $ value ) ; } if ( $ title ) $ title = "<p><b>$title</b></p>" ; // Exclude some properties ($excludeProps) from $value. $ value = array_diff_key ( $ value , array_fill_keys ( $ excludeProps , false ) ) ; if ( $ excludeEmpty ) $ value = array_prune_empty ( $ value ) ; return $ value ? "$title<table class=__console-table><colgroup><col width=160><col width=100%></colgroup>
" . implode ( '' , map ( $ value , function ( $ v , $ k ) use ( $ depth , $ maxDepth , $ excludeProps , $ excludeEmpty ) { $ v = self :: grid ( $ v , '' , $ maxDepth , $ excludeProps , $ excludeEmpty , $ depth + 1 ) ; return "<tr><th>$k<td>$v" ; } ) ) . "
</table>" : '<i>[]</i>' ; }
Generates a table with a header column and a value column from the given array.

@param mixed  $value
@param string $title        [optional]
@param int    $maxDepth     [optional] Max. recursion depth.
@param array  $excludeProps [optional] Exclude properties whose name is on the list.
@param bool   $excludeEmpty [optional] Exclude empty properties.
@param int    $depth        [optional] For internal use.
@return string
Generates a table with a header column and a value column from the given array .