array_filter 过滤一维中空数组,数组的序列不变

<?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
)

  

原文地址:https://www.cnblogs.com/pansidong/p/7753631.html