Skip to content

Instantly share code, notes, and snippets.

@muriloazevedo
Created May 16, 2013 23:12
Show Gist options
  • Save muriloazevedo/5595841 to your computer and use it in GitHub Desktop.
Save muriloazevedo/5595841 to your computer and use it in GitHub Desktop.
leitura de arquivo
<?php
$arquivo = file('file.txt'); // arquivo em ISO-8859-1
foreach ($arquivo as $linha) {
$dados_linha = explode(';', $linha);
echo '<pre>' . print_r($dados_linha) . '</pre>';
}
/**
Array ( [0] => ES [1] => VITÓRIA [2] => JOÃO [3] => PRODUTO 1 )
1
Array ( [0] => ES [1] => VITÓRIA [2] => JOÃO [3] => PRODUTO 1 )
1
Array ( [0] => ES [1] => VITÓRIA [2] => JOÃO [3] => PRODUTO 1 )
1
Array ( [0] => ES [1] => VITÓRIA [2] => JOÃO [3] => PRODUTO 1 )
1
Array ( [0] => ES [1] => VITÓRIA [2] => JOÃO [3] => PRODUTO 1 )
**/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment