zoukankan      html  css  js  c++  java
  • 过滤数组中的空数组array_filter()

    手册查询array_filter()的使用细节时,看到了:If no callback is supplied, all entries of input equal to FALSE (see converting to boolean) will be removed. 如果没有给出回调函数,所有的等于 FALSE 的元素将会被移除掉!

    刚好可以用来移除数组中的空元素!

    使用:$arr = array_filter($arr);

    <?php
    $arr=array(1,2,3,null,'',false);
    $new=array_filter($arr);
    echo '<pre>';
    print_r($new);
    echo '<pre>';
    

     结果:

     



    原文:https://blog.csdn.net/guaiguaiknl/article/details/60961782

  • 相关阅读:
    ARC 080
    CodeForces
    [Lydsy1806月赛] 路径统计
    AGC 022 C
    AGC 022 B
    AGC 020 B
    UVA
    AGC 018 A
    python
    python
  • 原文地址:https://www.cnblogs.com/lxwphp/p/15453458.html
Copyright © 2011-2022 走看看