The glob () function searches for all file paths that match the pattern according to the rules used by the libc glob () function.
$ Files = Glob ('*. PHP '); Print_r ( $ Files ); /* Array ([0] => phptest. php [1] => pi. php [2] => post_output.php [3] => test. php) */ $ Files = Glob ('*. {PHP, TXT }', Glob_brace ); Print_r ( $ Files ); /* Array ([0] => phptest. PHP [1] => pi. PHP [2] => post_output.php [3] => test. PHP [4] => log.txt [5] => test.txt) */ // Note that these files can actually return a path, depending on the query conditions. $ Files = Glob ('../Images/*. JPG '); Print_r ( $ Files ); /* Array ([0] => ../images/apple.jpg [1] => ../images/art.jpg) */ // If you want to obtain the complete path of each file, you can call the realpath () function. $ Files = Glob ('../Images/*. JPG '); $ Files = Array_map (' Realpath ', $ Files ); Print_r ( $ Files ); /* Array ([0] => C: \ Wamp \ www \ images \ apple.jpg [1] => C: \ Wamp \ www \ images \ art.jpg) */