Several common unempty, grouping, and debugging array functions. Dump () uses arrays in array format to debug functiondump ($ vars, $ label, $ returnfalse) {if (ini_get (html_errors) {$ contentpre; if ($ label !) {$ Content. dump () uses arrays in array format for debugging.
Function dump ($ vars, $ label =, $ return = false ){
If (ini_get (html_errors )){
$ Content ="
";
if ($label != ) {
$content .= "{$label} :";
}
$content .= htmlspecialchars(print_r($vars, true));
$content .= "
";
} Else {
$ Content = $ label. ":". print_r ($ vars, true );
}
If ($ return) {return $ content ;}
Echo $ content;
Return null;
}
Array_remove_empty () removes null elements from the array.
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 default function is to divide the function evenly
Http://www.bkjia.com/PHPjc/486547.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/486547.htmlTechArticledump () puts arrays in array format, which is useful for debugging function dump ($ vars, $ label =, $ return = false) {if (ini_get (html_errors )) {$ content = pre; if ($ label! =) {$ Content. =...