protected function Dbug::varIsArray in dBug for Drupal 2.0.x
Same name and namespace in other branches
- 8 src/Dbug.php \Drupal\dbug\Dbug::varIsArray()
- 1.0.x src/Dbug.php \Drupal\dbug\Dbug::varIsArray()
If variable is an array type.
Parameters
mixed $var: The variable.
1 call to Dbug::varIsArray()
- Dbug::checkType in src/
Dbug.php - Check variable type.
File
- src/
Dbug.php, line 369
Class
- Dbug
- Implementation of dBug for Drupal.
Namespace
Drupal\dbugCode
protected function varIsArray($var) {
$var_ser = serialize($var);
array_push($this->arrHistory, $var_ser);
$this
->makeTableHeader("array", "array");
if (is_array($var)) {
foreach ($var as $key => $value) {
$this
->makeTdHeader("array", $key);
// Check for recursion.
if (is_array($value)) {
$var_ser = serialize($value);
if (in_array($var_ser, $this->arrHistory, TRUE)) {
$value = "*RECURSION*";
}
}
if (in_array(gettype($value), $this->arrType)) {
$this
->checkType($value);
}
else {
$value = trim($value) == "" ? "[empty string]" : $value;
$this->output[] = $value;
}
$this->output[] = $this
->closeTdRow();
}
}
else {
$this->output[] = "<tr><td>" . $this
->error("array") . $this
->closeTdRow();
}
array_pop($this->arrHistory);
$this->output[] = "</table>";
}