It's a silly test, because it will always be true: $file is either not '.' or not '..', and it can't exactly go around being both.
If you're wanting to ensure that $file is neither '.' nor '..' then you should say that it's not '.' or '..'
if(!($file=='.' || $file=='..'))
which can be simplified (basic logic) to
if($file!='.' && $file!='..')
Which obviously says "if $file is not '.' AND $file is not '..'.