title: Storing last line of file in an array continuously in PHP
body: <p>So i have a little issue with some PHP read functionality. What I am trying to do is basically grab data into an array from a file that is being continuously updated from a python script reading values from a micro controller. So basically, the file would look something like this.</p>
  
  <pre><code>ID, Datetime, Count, Name
  ID, Datetime, Count, Name
  ID, Datetime, Count, Name
  </code></pre>
  
  <p>What i need is for it to read the new line that is being added in (eof) and store it into an array. So what i have so far is allowing read access into the file</p>
  
  <pre><code>  &lt;?php
  $myfile = fopen("read.txt", "r")
  </code></pre>
  
  <p>For the storing the lines in an array i figured something like an array map would be efficient </p>
  
  <pre><code>$result = array();
   // some loop
    $parts = array_map('trim', explode(':', $line_of_text, 2)));
    $result[$parts[0]] = $parts[1];
  </code></pre>
  
  <p>However i am not to sure on how to structure the loop to have it read the new line that is being updated in the file without exiting the loop.</p>
  
  <pre><code>while (feof($file)) {
  }
  
  fclose($file);
  ?&gt;
  </code></pre>
  
  <p>Any help would be appreciated!!</p>