title: Break PHP while loop if variable is empty
body: <p>I have a CSV (attached below) that I am looping through with PHP. Note: the <code>Peter</code> entry is missing an <code>Extension</code> number.</p>
  
  <p>How do I break the loop if any $cell (like <code>Extension</code>) is empty</p>
  
  <pre><code>&lt;?php
  echo "&lt;html&gt;&lt;body&gt;&lt;table&gt;\n\n";
  $f = fopen("users.csv", "r");
  while (($line = fgetcsv($f)) !== false) {
          echo "&lt;tr&gt;";
          foreach ($line as $cell) {
                  echo "&lt;td&gt;" . htmlspecialchars($cell) . "&lt;/td&gt;";
          }
          echo "&lt;/tr&gt;\n";
  }
  fclose($f);
  echo "\n&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;";
  </code></pre>
  
  <p>~</p>
  
  <pre><code>Forename,Surname,Extension
  Jim,Carey,1973
  Peter,Robertson,
  </code></pre>