note 36778 added to function.scandir

From: Date: Wed, 22 Oct 2003 07:15:35 +0000
Subject: note 36778 added to function.scandir
Groups: php.notes 
Request: Send a blank email to php-notes+get-59095@lists.php.net to get a copy of this message
The previous gentleman's code states: if (ereg("$ext", $filename, $regs)) I believe this doesn't quite catch the required files. For example, if you want to get all gif files (ie $ext="gif"), the above code will get a file called "gif.txt". My suggestion is this: if (preg_match("/" . $ext . "$/",$filename)) ---- Manual Page -- http://www.php.net/manual/en/function.scandir.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+36778 Delete -- http://master.php.net/manage/user-notes.php?action=delete+36778&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+36778&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#59095) next »