How do you understand the code? Array_filter

Source: Internet
Author: User
Tags true true
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

------Solution--------------------
Array Array_filter (array [, Callback callback])

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
  • Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.