note 82208 modified in function.rmdir by danbrown

From: Date: Tue, 10 Mar 2009 19:42:31 +0000
Subject: note 82208 modified in function.rmdir by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-151703@lists.php.net to get a copy of this message
Or even just <?php function deltree($f) { if (is_dir($f)) { foreach(glob($f.'/*') as $sf) { if (is_dir($sf) && !is_link($sf)) { deltree($sf); } else { unlink($sf); } } } rmdir($f); } ?> ...As we're already calling rmdir($f) at the end of deltree. --was-- Or even just function deltree($f) { if (is_dir($f)) { foreach(glob($f.'/*') as $sf) { if (is_dir($sf) && !is_link($sf)) { deltree($sf); } else { unlink($sf); } } } rmdir($f); } ...As we're already calling rmdir($f) at the end of deltree. http://php.net/manual/en/function.rmdir.php

« previous php.notes (#151703) next »