title: php retrieve data from text file
body: <p>Imagine I have a certain text file like this:</p>
  
  <pre><code> Welcome to the text file!
   -------------------------
   Description1: value1
   Description2: value2
   Description containing spaces: value containing spaces
   Description3: value3
  </code></pre>
  
  <p>Storing this data into a text file would be easy, like this:</p>
  
  <pre><code> $file = 'data/preciousdata.txt';
   // The new data to add to the file
   $put = $somedescription .": ". $somevalue;
   // Write the contents to the file, 
   file_put_contents($file, $put, FILE_APPEND | LOCK_EX);
  </code></pre>
  
  <p>With a different description and value every time I write to it.</p>
  
  <p>Now I would like to read the data, so you would get the file:</p>
  
  <pre><code> $myFile = "data/preciousdata.txt";
   $lines = file($myFile);//file in to an array
  </code></pre>
  
  <p>Lets say I just wrote "color: blue" and "taste: spicy" to my text file. I don't know on which lines they are, and I want to retrieve the value of the "color:" description.</p>
  
  <p><strong>Edit</strong>
  Should I let php "search" though the file, return the number of the line that contains the "description", then put the line in a string and remove everything for the ":"?</p>