How can PHP access a folder that is otherwise restricted by htaccess?

When a folder is restricted by an htaccess file, PHP scripts within that folder may not be able to access it directly. One way to bypass this restriction is to use PHP to read the contents of the folder and retrieve the files. This can be done by using PHP's `scandir()` function to get a list of files in the folder, even if it is restricted by htaccess.

$folder = 'restricted_folder';
$files = scandir($folder);

foreach($files as $file) {
    echo $file . "<br>";
}