You are here

static function krumo::_vars in Devel 6

Same name and namespace in other branches
  1. 7 krumo/class.krumo.php \krumo::_vars()

* Render a dump for the properties of an array or objeect * *

Parameters

mixed &$data: * @access private * @static

2 calls to krumo::_vars()
krumo::_array in krumo/class.krumo.php
* Render a dump for an array * *
krumo::_object in krumo/class.krumo.php
* Render a dump for an object * *

File

krumo/class.krumo.php, line 913

Class

krumo
Krumo API

Code

static function _vars(&$data) {
  $_is_object = is_object($data);

  // test for references in order to
  // prevent endless recursion loops
  //
  $_recursion_marker = krumo::_marker();
  $_r = $_is_object ? @$data->{$_recursion_marker} : @$data[$_recursion_marker];
  $_r = (int) $_r;

  // recursion detected
  //
  if ($_r > 0) {
    return krumo::_recursion();
  }

  // stain it
  //
  krumo::_hive($data);

  // render it
  //
  ?>
<div class="krumo-nest" style="display:none;">
	<ul class="krumo-node">
	<?php


  // keys ?
  //
  $keys = $_is_object ? array_keys(get_object_vars($data)) : array_keys($data);

  // itterate
  //
  foreach ($keys as $k) {

    // skip marker
    //
    if ($k === $_recursion_marker) {
      continue;
    }

    // get real value
    //
    if ($_is_object) {
      $v =& $data->{$k};
    }
    else {
      $v =& $data[$k];
    }

    // PHP 4.x.x array reference bug...
    //
    if (is_array($data) && version_compare(PHP_VERSION, "5", "<")) {
      $GLOBALS[krumo::_marker()][] =& $v;
    }
    krumo::_dump($v, $k);
  }
  ?>
	</ul>
</div>
<?php

}