本文整理汇总了PHP中Dumper::is_assoc方法的典型用法代码示例。如果您正苦于以下问题:PHP Dumper::is_assoc方法的具体用法?PHP Dumper::is_assoc怎么用?PHP Dumper::is_assoc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dumper
的用法示例。
在下文中一共展示了Dumper::is_assoc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _array
/**
* Render a dump for an array
*
* @param mixed $data
* @param string $name
* @access private
* @static
*/
private static function _array($data, $name)
{
$config_sort = Dumper::_config('display', 'sort_arrays', true);
// If the sort is enabled in the config (default = yes) and the array is assoc (non-numeric)
if (sizeof($data) > 1 && $config_sort && Dumper::is_assoc($data)) {
// Copy the array to a temp variable and sort it
$new = $data;
ksort($new);
// If the sorted array is the same as the old don't sort it
if ($new === $data) {
$sort = 0;
} else {
$data = $new;
$sort = 1;
}
} else {
$sort = 0;
}
$childCount = count($data);
$collapsed = Dumper::_isCollapsed(self::$_level, count($data));
// Setup the CSS classes depending on how many children there are
if ($childCount > 0 && $collapsed) {
$elementClasses = ' dumper-expand';
} elseif ($childCount > 0) {
$elementClasses = ' dumper-expand dumper-opened';
} else {
$elementClasses = '';
}
print "<li class=\"dumper-child\">";
print "<div class=\"dumper-element {$elementClasses}\"";
// If there is more than one, make a dropdown
if (count($data) > 0) {
print "onClick=\"dumper.toggle(this);\"";
}
print "onMouseOver=\"dumper.over(this);\" onMouseOut=\"dumper.out(this);\">";
print "<a class=\"dumper-name\">{$name}</a> <em class=\"dumper-type\">arr(<strong class=\"dumper-array-length\">";
print count($data) . "</strong>)</em>";
if (count($data) > 0) {
print " …";
}
if ($sort) {
$title = "Array has been sorted prior to display. This is configurable in dumper.ini.";
print " - <span title=\"{$title}\"><strong class=\"dumper-sorted\">Sorted</strong></span>";
}
// callback
if (is_callable($data)) {
$_ = array_values($data);
print "<span class=\"dumper-callback\"> |";
print " (<em class=\"dumper-type\">Callback</em>) <strong class=\"dumper-string\">";
if (!is_object($_[0])) {
echo htmlSpecialChars($_[0]);
} else {
echo htmlSpecialChars(get_class($_[0])) . "::";
}
echo htmlSpecialChars($_[1]) . "()</strong></span>";
}
print "</div>";
if (count($data)) {
Dumper::_vars($data);
}
print "</li>";
}