This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function rrmdir(string $dirPath): bool { | |
array_map(static fn (string $filePath) => is_dir($filePath) ? rrmdir($filePath) : unlink($filePath), glob($dirPath . '/' . '*')); | |
return rmdir($dirPath); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// turn on signal catching | |
pcntl_async_signals(true); | |
// handler | |
$sigHandler = static function(): void { | |
// do some cleanup | |
// report to user, whatever | |
// ... | |
exit(0); | |
}; |
OlderNewer