note 13763 added to function.readdir.php

From: Date: Mon, 02 Jul 2001 10:00:15 +0000
Subject: note 13763 added to function.readdir.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-14889@lists.php.net to get a copy of this message
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. http://www.php.net/manual/en/function.readdir.php

« previous php.notes (#14889) next »