PHP 8.5.0 Alpha 2 available for testing

Voting

: max(nine, five)?
(Example: nine)

The Note You're Voting On

dev dot abi dot log at gmail dot com
2 years ago
a simple snipped for removing empty dirs recursive :

<?php
function removeEmptyDirs($fullPath)
{
if(!
is_dir($fullPath)){
return;
}

$children = array_diff(scandir($fullPath), ['.','..']);

foreach(
$children as $child){
removeEmptyDirs($fullPath. $child. DIRECTORY_SEPARATOR);
}

$children = array_diff(scandir($fullPath), ['.','..']);
if(empty(
$children)){
echo
"the $fullPath empty directory has been removed.\n";
rmdir($fullPath);
}
}
?>

<< Back to user notes page

To Top