1. 程式人生 > >array_filter 過濾一維中空數組,數組的序列不變

array_filter 過濾一維中空數組,數組的序列不變

logs type arp true [1] ont cnblogs content 序列

<?php
header(‘Content-type:text;charset=utf8‘);

$str = "%11111%22222%333333%";
$arr = explode(‘%‘,$str);
print_r($arr);

print_r(array_filter($arr));
?>
--------------------------------------------------
Array
(
    [0] => 
    [1] => 11111
    [2] => 22222
    [3] => 333333
    [4] => 
)
Array
(
    [1] => 11111
    [2] => 22222
    [3] => 333333
)

  

array_filter 過濾一維中空數組,數組的序列不變