title: Getting the list of files over FTP
body: <p>I want to print the list of files and only files from an FTP server, here is what I could accomplish.</p>
  
  <pre><code>&lt;?php
      $ftp_server = "my ftp server";
      $conn_id = ftp_connect($ftp_server);
      $ftp_user_name = "ftp username";
      $ftp_user_pass = "ftp password";
      $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
      $contents = ftp_nlist($conn_id, '/');
      for ($i = 0 ; $i &lt; count($contents) ; $i++)
          echo "&lt;li&gt;" . substr($contents[$i],1) . "&lt;/li&gt;";
      ftp_close($conn_id);
  ?&gt;
  </code></pre>
  
  <p>but this prints the names of files and folders. How can I just print the names of files (files may not have extensions!)</p>