dump() 把数组以数组格式数组,有益于调试 function dump($vars, $label = , $return = false){
if (ini_get(html_errors)) {
$content = "
";<BR> if ($label != ) {<BR> $content .= "<strong>{$label} :</strong>
";<BR> }<BR> $content .= htmlspecialchars(print_r($vars, true));<BR> $content .= "
} else {
$content = $label . " :
" . print_r($vars, true);
}
if ($return) { return $content; }
echo $content;
return null;
}
array_remove_empty()去除数组中为空的元素
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默认函数 作用是把函数平均分组
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号