note 21695 added to ref.dir

From: Date: Thu, 23 May 2002 15:10:37 +0000
Subject: note 21695 added to ref.dir
Groups: php.notes 
Request: Send a blank email to php-notes+get-30945@lists.php.net to get a copy of this message
//lists all files in a directory with a given file name convention function list_dir($file_name_convention) { switch ($file_name_convention) { case 'dated_reports': //matches files like '5_23_2002.html' $this_regexp = "/[0-9]{1,}_[0-9]{1,}_[0-9]{4,}/"; break; //add more cases of file name conventions } $this_dir = dir('.'); if ($this_regexp != null) { while ($file = $this_dir->read()) { if (preg_match($this_regexp, $file)) { $result_array[] = $file; } } } return $result_array; } -- http://www.php.net/manual/en/ref.dir.php http://master.php.net/manage/user-notes.php?action=edit+21695 http://master.php.net/manage/user-notes.php?action=delete+21695 http://master.php.net/manage/user-notes.php?action=reject+21695

« previous php.notes (#30945) next »