php array_filter除去数组中的空字符元素


除去数组中的空字符元素
复制代码 代码如下:

<?php
$str1_array=array('phpStudy','','http://www.phpstudy.net','','1654','');
$str1_array=array_filter($str1_array);
print_r($str1_array);
?>

显示结果:
复制代码 代码如下:

Array
(
[0] => phpStudy
[2] => http://www.phpstudy.net
[4] => 1654
)

« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3