What are some best practices for handling hidden files and directories when using glob() in PHP?
When using glob() in PHP to retrieve files and directories, hidden files and directories (those starting with a dot) are not included by default. To include hidden files and directories, you can use the GLOB_NOSORT flag along with GLOB_MARK to include directories in the result set. This will allow you to retrieve all files and directories, including hidden ones.
$files = glob('./*', GLOB_MARK | GLOB_BRACE | GLOB_NOSORT);
foreach ($files as $file) {
echo $file . PHP_EOL;
}