title: using preg_match in a variable
body: <p>urlI have a log file that has dates in the 2015-03-10 format. So I am taking that log and trying to put a line break in front of each of those dates because the date signifies the beginning of a new log item/line, and the end of the log item/line has nothing unique to use that as a place to put the line break.</p>
  
  <p>I am trying to use preg_match and am very close to getting it figured out but I am doing something wrong in one of the lines.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>header('Content-Type: text/html; charset=utf-8');
  $phrase = file_get_contents('url_to_log');
  $pattern = '/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/';
  $store = preg_match_all($pattern, $phrase);
  $replacement = '&lt;br&gt;'. $store .'';
  
  echo preg_replace($pattern, $replacement, $phrase);
  </code></pre>
  
  <p>Here is the result of the above code</p>
  
  <pre><code>{"type":"success","response":{"data":{"thispage":100,"totalpages":1,"log":"&lt;\/TIT2&gt;&lt;\/metadata&gt;]\n
  66 08:34:00\tINFO\t[ADMINCGI] XML title update [Eat pizza every night\n&lt;\/TIT2&gt;&lt;\/metadata&gt;]\n
  66 08:38:23\tINFO\t[ADMINCGI] XML title update [Its not a tumor\n&lt;\/TIT2&gt;&lt;\/metadata&gt;]\n
  66 08:42:45\tINFO\t[ADMINCGI] XML title update [Title of a random music track\n&lt;\/TIT2&gt;&lt;\/metadata&gt;]\n
  66 08:48:38\tINFO\t[ADMINCGI] XML title update [Title of stuff Random\n&lt;\/TIT2&gt;&lt;\/metadata&gt;]\n
  </code></pre>
  
  <p>I am sure you notice that the 2015-03-10 format, is being replaced by 66, instead of the date that was originally there with a line break just appended to the front of it.</p>
  
  <p>What am I missing?</p>