You are here

function om_tools_display_array_recursion in OM Tools 8.2

Same name and namespace in other branches
  1. 6.2 inc/om_tools.utils.inc \om_tools_display_array_recursion()
  2. 7.2 inc/om_tools.utils.inc \om_tools_display_array_recursion()

OM Tools Recurser

1 call to om_tools_display_array_recursion()
om_tools_display_values_get in inc/om_tools.utils.inc
OM Tools variable parser

File

inc/om_tools.utils.inc, line 152
OM Tools Admin Utilities

Code

function om_tools_display_array_recursion($var = array()) {
  $display = '';
  static $level = 1;

  // count level for indents on divs on html file
  $tab = '';

  // init tab for indents on divs on html file
  // for source formating
  // calculates number of tabs
  for ($i = 1; $i <= $level; $i++) {
    $tab .= "\t";
  }
  foreach ($var as $key => $val) {
    if (is_array($val)) {
      $level++;
      $display .= $tab . om_tools_string($key) . ' => array(' . "\n";
      $display .= om_tools_display_array_recursion($val);
      $display .= $tab . '),' . "\n";
      $level--;
    }
    else {
      $display .= $tab . om_tools_string($key) . ' => ' . om_tools_string($val) . ',' . "\n";
    }
  }
  return $display;
}