Easy Tutorial
❮ Filter Sanitize Magic Quotes Func Mysqli Get Host Info ❯

PHP glob() Function



Definition and Usage

The glob() function returns an array containing the filenames or directories matching a specified pattern.

This function returns an array containing the matched files/directories. If it fails, it returns FALSE.

Syntax

Parameter Description
pattern Required. Specifies the search pattern.
flags Optional. Specifies special settings. Possible values: GLOB_MARK - Adds a slash to each item returned<br> GLOB_NOSORT - Returns files as they appear in the directory (no sorting)<br> GLOB_NOCHECK - Returns the search pattern if no files match<br> GLOB_NOESCAPE - Backslashes do not escape metacharacters<br> GLOB_BRACE - Expands {a,b,c} to match 'a', 'b', or 'c'<br> GLOB_ONLYDIR - Returns only directory entries that match the pattern<br> GLOB_ERR - (Added in PHP 5.1) Stops on errors, by default errors are ignored

Example 1

The above code will output:


Example 2

The above code will output:


❮ Filter Sanitize Magic Quotes Func Mysqli Get Host Info ❯