How do I remove spaces from a text file? I tried the code below but I could not:
The file
10400000         2090183800001990000000000000000000001234204321000000000EMPRESA                       C ECON FEDERAL                          20601201405551100162204000000                    RETORNO-PRODUCAO                  000            
10400011T0100030 20090183800001990000000000000000000001234204321000000000EMPRESA                                                                                                       00001622060120140000000000 
How the file has to stay:
02RETORNO0000000000000000011119999990000000000000000000000000000000000000000104000000000000000201016000000000
The code
 $arquivo = fopen($_FILES["Arquivo"]["tmp_name"], "r");
$arquivo = preg_replace('/\s+/', '', $arquivo);
while (!feof($arquivo)) {
  $linhas = fread($ler,999999);
  $banco = substr($linhas,0,3);
  $lote = substr($linhas,4,7);
  $registro = substr($linhas,8,8);
}
echo "Banco: " .$banco. "<br>";
echo "Lote: " .$lote. "<br>";
echo "Registro: " .$registro. "<br>";
