How do I remove spaces from a text file? I have the following text file:
LC1 00019 1 31012012 00001 00243206
I uploaded and put the following code:
$abrirArquivo = fopen($uploadArquivo, "r");
while(!feof($abrirArquivo)){
$ler = fgets($abrirArquivo,460);
$quebrar = explode(" ",trim($ler));
print_r($quebrar)."<br>";
}
fclose($abrirArquivo);
But when I gave print_r()
, it appeared like this:
Array ([0] => LC1 [1] => 00001 [2] = > [3] = > [4] = > 1 [5] = > 31012012 [6] = > [7] = > [8] = > [9] = > [10] = > [11] = > [12] = > [13] = > [14] = > [15] = > 00001
Note that many keys are missing values. How do I resolve this problem?