Home > Backend Development > PHP Tutorial > Several commonly used PHP denulling, grouping, and debugging array functions_PHP tutorial

Several commonly used PHP denulling, grouping, and debugging array functions_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 17:37:26
Original
866 people have browsed it

dump() converts the array into array format, which is helpful for debugging

function dump($vars, $label = , $return = false){
if (ini_get(html_errors)) {
$content = "

“;
";<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() removes empty elements in 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) {
                                                                                                                                     
array_chunk() php default function is to group functions evenly




http://www.bkjia.com/PHPjc/486562.html

www.bkjia.com

true

http: //www.bkjia.com/PHPjc/486562.htmlTechArticledump() Array the array in array format, which is beneficial for debugging function dump($vars, $label =, $ return = false){ if (ini_get(html_errors)) { $content = "pre"; if ($label != ) { $content....
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template