mp3 list

From: Alexandre (no_at_msn.com)
Date: 12/30/04


Date: 30 Dec 2004 15:01:01 GMT

Hi I can't figure why I can't list only mp3 files with this code :

<?php
  $dir = opendir(".");
  while($file = readdir($dir)) {
          $ext = getFileExtension($file);
        if ($ext = "mp3") {
                     echo "<a href=" .$file.">".$file;
          echo "<p>";
                   }
             }
  closedir($dir);

  function getFileExtension($str) {
        $i = strrpos($str,".");
        if (!$i) { return ""; }
        $l = strlen($str) - $i;
        $ext = substr($str,$i+1,$l);
        return $ext;
    }

 ?>