You are here

function drupalforfirebug_show_array in Drupal For Firebug 6

Same name and namespace in other branches
  1. 5 drupalforfirebug.module \drupalforfirebug_show_array()
  2. 7.2 drupalforfirebug.module \drupalforfirebug_show_array()
  3. 7 drupalforfirebug.module \drupalforfirebug_show_array()
1 call to drupalforfirebug_show_array()
html_drupalforfirebug_show_array in ./drupalforfirebug.module

File

./drupalforfirebug.module, line 461

Code

function drupalforfirebug_show_array($array, $level, $sub) {
  $output = '';
  if (is_array($array) == 1) {

    // check if input is an array
    foreach ($array as $key_val => $value) {
      $offset = "";
      if (is_array($value) == 1) {

        // array is multidimensional
        $output .= "<tr>";
        $offset = do_offset($level);
        $output .= $offset . "<td>" . $key_val . "</td>";
        $output .= drupalforfirebug_show_array($value, $level + 1, 1);
      }
      else {

        // (sub)array is not multidim
        if ($sub != 1) {

          // first entry for subarray
          $output .= "<tr nosub>";
          $offset = do_offset($level);
        }
        $sub = 0;
        $output .= $offset . "<td main " . $sub . " width=\"120\">" . $key_val . "</td><td width=\"120\">" . $value . "</td>";
        $output .= "</tr>\n";
      }
    }

    //foreach $array
  }
  return $output;
}