title: Notice Undefined offset
body: <p>Im new to php and having some trouble with a notice. "Notice: Undefined offset: 1" The problem is on line 38:</p>
  
  <blockquote>
  <pre><code>  $commentator_comment = $comment_array[$i+1];
  </code></pre>
  </blockquote>
  
  <p>When I wrote this code I worked on an old laptop where I had to work on a server, since WAMP etc. didnt work, and I didnt get the notice then. Its awhile ago I wrote it, but Im trying my best to find the problem without luck.</p>
  
  <pre><code>&lt;?php
  $filename = "data/comments.txt";
      if( isset( $_POST["name"]) &amp;&amp; isset( $_POST["comment"])) {
  $comment_name = @$_POST["name"];
  $comment_comment = @$_POST["comment"];
  $theComment = "&lt;div id='comment'&gt;&lt;p&gt;&lt;b&gt;" . $comment_name . "&lt;/b&gt;&lt;br&gt;" . $comment_comment . "&lt;/p&gt;&lt;/div&gt;";
  
  file_put_contents($filename, $theComment, FILE_APPEND);}
  ?&gt;
  
  &lt;?php
  $comments_from_file = file_get_contents($filename);
  $comment_array = str_getcsv($comments_from_file, "|");
  $i = 0;
  while ($i &lt; count($comment_array)){
      $commentator_name = $comment_array[$i];
      $commentator_comment = $comment_array[$i+1];
  
      echo "$commentator_name" . "$commentator_comment";
  
  
      $i = $i + 2;
  
  }?&gt;
  </code></pre>
  
  <p>Thanks in advance on all help, its appriciated. </p>