note 101374 added to function.unlink
| From: | anthony dot boulmier dot cfpt at gmail dot com | Date: | Mon, 13 Dec 2010 14:42:26 +0000 |
| Subject: | note 101374 added to function.unlink | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174842@lists.php.net to get a copy of this message | ||
This function is as short as possible but i think it could be improved
/*
BOULMIER ANTHONY
13.12.2010
name: killdir
Description :A recursive function is used to delete a directory with 0,* files or directories in
him.
@params : path of the directory
@return : nothing
*/
function killdir($path)
{
$tab_file = scandir($path,0);
for($i=2;$i<count($tab_file);$i++)
{
if(is_dir($path."/".$tab_file[$i]))
{
$newpath = $path."/".$tab_file[$i];
killdir($newpath);
}else unlink($path."/".$tab_file[$i]);
}
rmdir($path);
}
----
Server IP: 62.2.182.223
Probable Submitter: 178.83.221.161
----
Manual Page -- http://www.php.net/manual/en/function.unlink.php
Edit -- https://master.php.net/note/edit/101374
Del: integrated -- https://master.php.net/note/delete/101374/integrated
Del: useless -- https://master.php.net/note/delete/101374/useless
Del: bad code -- https://master.php.net/note/delete/101374/bad+code
Del: spam -- https://master.php.net/note/delete/101374/spam
Del: non-english -- https://master.php.net/note/delete/101374/non-english
Del: in docs -- https://master.php.net/note/delete/101374/in+docs
Del: other reasons-- https://master.php.net/note/delete/101374
Reject -- https://master.php.net/note/reject/101374
Search -- https://master.php.net/manage/user-notes.php