title: How to read contents of a file in PHP
body: <p>I want to know how to read a file. Below is the code I'm executing but I get the wrong answer. My file <code>ding.txt</code> contains:</p>
  
  <pre><code>name, drinks,
  jay, sprite,
  chile, wine,
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>&lt;?php
  $top = file('ding.txt');
  foreach($top as $trick)
  {
      $m = preg_split( "/,/", $trick);
  
      foreach($m as $t)
      { 
          echo "$t[1]";
      }
  }
  ?&gt;
  </code></pre>