title: Issue in parsing a text file using PHP
body: <p>I have a .txt file in the following format:</p>
  
  <pre><code>topic: My Thesis | link: my_thesis.html |  date: 04-01-2013, 06:01 AM ~ postedby: smith ~ post: Has anyone worked on my thesis? ~ 
  topic: Thesis Submission | link: thesis_submission.html |  date: 05-10-2013, 08:20 PM ~ postedby: Terry ~ post: Anyone is working on thesis submission? ~  date: 05-11-2013, 10:04 AM ~ postedby: Julia ~ post: Working on it, will submit today at any time ~  date: 05-11-2013, 04:25 PM ~ postedby: Terry ~ post: Please get reviewed before submission, Thanks! ~  date: 05-11-2013, 10:00 PM ~ postedby: Smith ~ post: Hurryup We don't have time, Its already late ~ 
  </code></pre>
  
  <p>I have tried to get its output in this way but could not achieve it. Can anyone help me, please?</p>
  
  <p>topic: My Thesis <br/>
  link: my_thesis.html<br/>
  date:04-01-2013, 06:01 AM<br/>
  postedby:smith <br/>
  post:Has anyone worked on my thesis?<br/>
  topic:...<br/>
  link:..<br/>
  date:...<br/>
  postedby:...<br/>
  post:...<br/>
  date:...<br/>
  postedby:...<br/>
  post:...<br/>
  .....<br/>
  .....<br/></p>
  
  <p>Here is my code </p>
  
  <pre><code>$text = file_get_contents('c:\textfile.txt');
  $texts = explode("\n",$text);
  
  foreach($texts as $line) {
      $temp = explode('topic:',$line);            
      $topic = explode("|",$temp[1]); 
      echo "topic : " .$topic[0] ."&lt;br/&gt;"; 
      $temp = explode('link:',$line);
      $href = explode("|",$temp[1]);  
      echo "link : " .$topic[0] ."&lt;br/&gt;"; 
      $add = explode("|",$line);
      $adds = $add[2];    
  
      $rem = explode("\n",$adds);
  
      foreach($rem as $data) {            
          $temps = explode('date:',$data);                
          $date = explode('~',$temps[1]);     
          echo "date : " .$date[0] ."&lt;br/&gt;";      
          $temps = explode('postedby:',$data);        
          $postedby = explode('~',$temps[1]);
          echo "postedby: " .$postedby[0]  ."&lt;br/&gt;";
          $temps = explode('post:',$data);        
          $post = explode('~',$temps[1]);
          echo "post: " . $post[0] ."&lt;br/&gt;";  
      }
  }
  </code></pre>