title: "Undefined offset" error in search result
body: <p>I made a small code to search inside TXT file,
  It works, but I got an error in this part of the code:</p>
  
  <pre><code>function searchLastName(Array $array, $value)
  {
      $lastresult = '';
      foreach ($array as $subarray) {
          if (isset($subarray[1]) &amp;&amp; stristr($subarray[1], $value) &amp;&amp; $value != "") {
              $lastresult .= $subarray[0] . " " . $subarray[2] . " " . $subarray[1] . "&lt;br /&gt;";
          }
      }
      return $lastresult;
  }
  
  $file = fopen("classlist.txt", "r");
  $filestring = "";
  while (!feof($file)) {
      $tempstring = fgets($file);
      $filestring .= $tempstring . "&lt;br /&gt;";
      $line_of_text .= $tempstring;
  }
  </code></pre>
  
  <p>The first error in line 17 "Undefined variable: line_of_text" </p>
  
  <p>The second error in line 5 "Undefined offset:"</p>
  
  <p><strong>What I'm doing wrong?</strong></p>