title: parsing .srt files
body: <pre><code>1
  00:00:00,074 --&gt; 00:00:02,564
  Previously on Breaking Bad...
  
  2
  00:00:02,663 --&gt; 00:00:04,393
  Words...
  </code></pre>
  
  <p>i need to parse srt files with php and print the all subs in the file with variables.</p>
  
  <p>i couldn't find the right reg exps. when doing this i need to take the id, time and the subtitle variables. and when printing there musn't be no array() s or etc. must print just the same as in the orginal file.</p>
  
  <p>i mean i must print like;</p>
  
  <pre><code>$number &lt;br&gt; (e.g. 1)
  $time &lt;br&gt; (e.g. 00:00:00,074 --&gt; 00:00:02,564)
  $subtitle &lt;br&gt; (e.g. Previously on Breaking Bad...)
  </code></pre>
  
  <p>by the way i have this code. but it doesn't see the lines. it must be edited but how?</p>
  
  <pre><code>$srt_file = file('test.srt',FILE_IGNORE_NEW_LINES);
  $regex = "/^(\d)+ ([\d]+:[\d]+:[\d]+,[\d]+) --&gt; ([\d]+:[\d]+:[\d]+,[\d]+) (\w.+)/";
  
  foreach($srt_file as $srt){
  
      preg_match($regex,$srt,$srt_lines);
  
      print_r($srt_lines);
      echo '&lt;br /&gt;';
  
  }
  </code></pre>