【发布时间】:2012-07-10 06:40:50
【问题描述】:
我想从数组中删除空元素。我有一个由explode() 设置为数组的字符串。然后我使用array_filter() 删除空元素。但这不起作用。请参阅下面的代码:
$location = "http://www.bespike.com/Packages.gz";
$handle = fopen($location, "rb");
$source_code = stream_get_contents($handle);
$source_code = gzdecode($source_code);
$source_code = str_replace("\n", ":ben:", $source_code);
$list = explode(":ben:", $source_code);
print_r($list);
但它不起作用,$list 仍然有空元素。我也尝试过使用empty() 函数,但结果是一样的。
【问题讨论】:
-
你在哪里给
array_filter打电话?