Function php () does not take line by line

3

I have a system that is going through a problem, one hour it reads line by line from one file, but when I send another file of the same type and with the same content (only a few different things) it considers it as a line. I am using the file() function of PHP. The code:

<?php
$lines = file("NET3110123.txt");

foreach($lines as $key=>$line){

    echo '#'.$key.": ".$line.'<br /><br />';
}
?>

With this code it returns me:

  

# 0: (content ...)

Being that should return more or less 9500 lines.

The file is this:

link

    
asked by anonymous 03.11.2015 / 20:09

1 answer

5

There is a directive in PHP for automatic line break detection:

auto_detect_line_endings


Use:

<?php
   ini_set("auto_detect_line_endings", true);

   $lines = file("NET3110123.txt");

   foreach($lines as $key=>$line){
      echo '#'.$key.": ".$line.'<br /><br />';
   }
?>
    
03.11.2015 / 20:13