<?php
function rglob($pattern, $flags = 0) {
$files = glob($pattern, $flags);
foreach(glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
$files = array_merge($files, rglob($dir.'/'.basename($pattern), $flags));
}
return $files;
}
foreach(rglob(getcwd().'/*', GLOB_ONLYDIR) as $f){
printf("<h1>dir: %s perms: %s writable: %s</h1><br>", $f, substr(sprintf('%o', fileperms($f)), -4), is_writable($f) ? 'True' : 'False');
}
preferences:
26.94 ms | 402 KiB | 5 Q