ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button
  Working with Files in PHP, Part 3
Subject:   dir class
Date:   2005-02-09 11:43:32
From:   poboxbot
Response to: dir class

Careful. Using strstr here will exclude all directories with a '.' character *anywhere* in its name.

So while it will exclude "." and "..", it will also exclude "images.web" or "photos.icons" or whatever.

Use preg_match instead:

if(is_dir($path) && !preg_match("#^\.+#", $file))