php scan directory and read text file line by line code example Example: php get all php files in a directory foreach(glob('includes/*.php') as $file) { ... }