What PHP function can be used to search for files in a specific directory based on a certain criteria?

To search for files in a specific directory based on a certain criteria in PHP, you can use the `glob()` function. This function allows you to search for files using wildcard patterns like *.txt or *.jpg. You can specify the directory path and the search criteria as parameters to the `glob()` function.

$directory = '/path/to/directory/';
$search_criteria = '*.txt';

$files = glob($directory . $search_criteria);

foreach ($files as $file) {
    echo $file . "<br>";
}