If we want to read all files name or specific files name from directory , no need of worry php provide B.I.F(built in function) name as glob().
What this method do?
glob search path name with provide patterns and fetch all related files.
glob('dirname'/*.*');
above method will fetch all files with any extensions we can also fetch particular extensions using below syntax
glob('*.ext');