Find files with a pattern in a directory


define('DIR_PATH', 'DIRECTORY PATH');

$filenames = scandir(DIR_PATH);

$pattern = '/^PATTERN/';
$matches = array();
$matches[] = preg_grep($pattern, $filenames);

print_r($matches);