Well, there's a couple easy ways to do this. If you just want to ignore .php files, do this:
if ($file!="." && $file!=".." && substr($file,-4)!=".php" ){
That will just ignore the .php extension files. But say you only want to ignore some files. Put them in an array, then look for that.
$iggy = array("file1.php", "file2.blah", "file3.inc");
/* code, code, code */
if ($file!="." && $file!=".." && !in_array($file,$iggy)){
HTH