note 84218 deleted from function.glob by tularis

From: Date: Thu, 03 Jul 2008 21:33:15 +0000
Subject: note 84218 deleted from function.glob by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-141131@lists.php.net to get a copy of this message
Note Submitter: php at puetro dot net Reason: useless ---- sory for my english first. I ve been trying to reach out how can i recognize an empty direcotry. But everytime was the same problem. even the directory was empty, the result of count(glob.... was always 1. So i wrote this short code and it works fine: $dir = "directory"; //setting directory $count = count(glob("$dir/*.*")); //if there is more than 1 filer the result is correct if ($count==1) {$onepath=glob("$dir/*.*"); if ($onepath[0]=="") $count=0;} // the result can by 1 even the directory is empty, so if the result is 1 the prog. seek the result of 0 /first record in array/ and check if is emty or not. easy. try it!!

« previous php.notes (#141131) next »