重複の可能性:
空の配列要素を削除する
配列から空の要素を削除したい。によって配列に設定された文字列があります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()
関数でそれをやろうとしましたが、結果は同じです。