title: Reading .txt files with PHP and store information into variables
body: <p>I have a two <code>.txt</code> files that I need to read.
  The content of the two files is below</p>
  <blockquote>
  <p>log.txt</p>
  </blockquote>
  <pre><code>2013/04/20 01:08:11
  </code></pre>
  <p>and</p>
  <blockquote>
  <p>data.txt</p>
  </blockquote>
  <pre><code>MANUFACTURER: SISYSTEM
  MODELNAME: DX1
  BIRTHDATE: 19710108
  SEX: M
  </code></pre>
  <p>For log.txt i need to store the date from the first line and save it into mySQL database.</p>
  <p>For data.txt i need to store information from each line into variables. i.e:</p>
  <pre><code>$manufacturer = SISYSTEM;
  $modelname = DX1;
  $birthdate =  19710108;
  $sex = M;
  </code></pre>
  <p>For log.txt i can simply just read the first line using fget and store into one variable. However, for data.text, I am having trouble figuring out how to store multiple variables inside the loop. Here's what I have so far, but I don't know how to assign the values into new variables each time it goes through the while loop. Any help is appreciated!</p>
  <pre><code>&lt;?PHP
  
  $file_handle = fopen(&quot;data.txt&quot;, &quot;r&quot;);
  
  while (!feof($file_handle) ) {
  
     $line_of_text = fgets($file_handle);
     $parts = explode(':', trim($line_of_text) );
  
  
  }
  
  fclose($file_handle);
  
  ?&gt;
  </code></pre>