note 53665 added to function.rmdir

From: Date: Wed, 08 Jun 2005 16:44:34 +0000
Subject: note 53665 added to function.rmdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-90129@lists.php.net to get a copy of this message
The example in the previous note will stop and return false, if there is an empty subdirectory. I suggest to modify this snipplet of the previous example: <? $matching = glob($fileglob); if ($matching === false) { trigger_error(sprintf('No files match supplied glob %s', $fileglob), E_USER_WARNING); return false; } ?> Here is my version: <? $matching = glob($fileglob); if ($matching === false) { return true; } ?> If there are no matching files in the directory, there is no need to delete something or to trigger an error. It just returns true and the (empty) directory will be deleted by the rmdir command. ---- Manual Page -- http://www.php.net/manual/en/function.rmdir.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+53665 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53665&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53665&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53665&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53665&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53665&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+53665&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#90129) next »