Re: appreciation
| From: | Tim Streater | Date: | Fri, 12 Oct 2012 13:04:00 +0000 |
| Subject: | Re: appreciation | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-319432@lists.php.net to get a copy of this message | ||
On 12 Oct 2012 at 12:36, Maciek Sokolewicz <tularis@php.net> wrote:
> However, this is likely not what the OP wants. What he likely does want
> is to check if the filename is not '.' or
> '..'. Of course, there are numerous ways to do this. From very simple
> things like:
> if ( $filename != '.' && $filename != '..')
Personally if I have a loop looking at filenames in a directory, I'll start it with:
while (something)
{
if ($filename=='.' || $filename=='..') continue;
// rest of loop
}
That way, the unwanted cases don't clutter up the logic for the cases I do/might want.
--
Cheers -- Tim