Ask the expert how to understand the code? Array_filter
$arr =array (0,0,0,1,2,4,2);
$arr =array_filter ($arr);
Print_r ($arr);
?>
Don't need Array_filter (array,function)? Does the direct write array mean that the custom function value is zero? Or how do you understand that? Ask for advice
Array_filter () passes each value in array arrays to the callback function in turn. If the callback function returns TRUE, the current values of the array array are included in the returned result array. The key name of the array remains unchanged.
If the callback function is not provided, Array_filter () deletes all entries in the array that are equivalent to FALSE.
The equivalent of false is empty, false,0 ....
------Solution--------------------
Flase false False True True True
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.