note 13763 deleted from function.readdir by tomsommer

From: Date: Sun, 27 Jun 2004 13:14:34 +0000
Subject: note 13763 deleted from function.readdir by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-71884@lists.php.net to get a copy of this message
Note Submitter: haydn@sun.com ---- A note re: dwalet@po-box.mcgill.ca 's use of ereg(".ext", $file) above. This usage will find all files containing .ext NOT just the nam.ext files. So file.ext.foo will be listed aswell. Like sed you can use a "$" to symbolise the eol, so ereg(".ext$", $file) will return only files ending in ".ext" So the line: if ($file != "." && $file != ".." && ereg(".foo",$file)) Should read: if ($file != "." && $file != ".." && ereg(".foo$",$file)) To avoid listing ".foo.baa" ext's.

« previous php.notes (#71884) next »