|
function dump($vars, $label = '', $return = false){
if (ini_get('html_errors')) {
$content = "<pre>/n";
if ($label != '') {
$content .= "<strong>{$label} :</strong>/n";
}
$content .= htmlspecialchars(print_r($vars, true));
$content .= "/n</pre>/n";
} else {
$content = $label . " :/n" . print_r($vars, true);
}
if ($return) { return $content; }
echo $content;
return null;
}
array_remove_empty()去除數(shù)組中為空的元素
function array_remove_empty(& $arr, $trim = true){
foreach ($arr as $key => $value) {
if (is_array($value)) {
array_remove_empty($arr[$key]);
} else {
$value = trim($value);
if ($value == '') {
unset($arr[$key]);
} elseif ($trim) {
$arr[$key] = $value;
}
}
}
}
array_chunk() php默認函數(shù) 作用是把函數(shù)平均分組
php技術(shù):php下幾個常用的去空、分組、調(diào)試數(shù)組函數(shù),轉(zhuǎn)載需保留來源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。