I have a .ret file which returns me as follows:
10400000
2090183800001990000000000000000000001234204321000000000EMPRESA
C ECON FEDERAL 20601201405551100162204000000 RETURN-PRODUCTION 000 10400011T0100030
I put in only one slice, because it is large. To remove the spaces, I did this:
$arquivo = file($_FILES["Arquivo"]["tmp_name"]);
$arquivo = preg_replace('/\s+/', '', $arquivo);
foreach($arquivo as $linhasNum => $linhas) {
$testes = substr($arquivo[$linhasNum],63,19);
}
echo $testes;
When I give a print_r () in the $ file variable, it returns me:
Array ([0] = > 104000002090183800001990000000000000000000001234204321000000000EMPRESACECONFEDERAL20601201405551100162204000000RETORNO-PRODUCAO000 [1] = > 10400011T010003020090183800001990000000000000000000001234204321000000000EMPRESA0000162206012014000000000000 [2] = > 1040001300001T060000000432100000000240000000111369979100000000000000002012014000000000008000000010860000000000000000090000000000000000000000000000125020101
Up to key [21] which is the last one. The problem is that in the test, it is returning only this last key and not in order for me to get the correct values. I do not know if I could make it understand, but how do I make the loop go through all the keys in order and not only get the last one?