1、清空数组中的空白项;
$data = ['1','2','3','8','','0','9']; print_r(array_filter($data,function($v){return !empty($var);}));
输出结果会为
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 8 [6] => 9 )
1、清空数组中的空白项;
$data = ['1','2','3','8','','0','9']; print_r(array_filter($data,function($v){return !empty($var);}));
输出结果会为
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 8 [6] => 9 )