The glob() function returns an array of filenames or directories matching a specified pattern.
PHP glob() Function has the following syntax.
glob(pattern,flags)
Parameter | Is Required | Description |
---|---|---|
pattern | Required. | Pattern to search for |
flags | Optional. | Special settings. |
Possible values:
This function returns an array of files/directories, or FALSE on failure.
Returns an array of filenames or directories matching a specified pattern
<?php
print_r(glob("*.txt"));
print_r(glob("*.*"));
?>
The code above generates the following result.