Home / PHP Tips Generated By ChatGPT / Using glob() to Find Files Matching a Pattern in PHP Find all PHP files in a directory using glob(). Source Code foreach (glob("*.php") as $file) { echo $file . "n"; }