note 58197 added to function.glob

From: Date: Thu, 27 Oct 2005 07:27:22 +0000
Subject: note 58197 added to function.glob
Groups: php.notes 
Request: Send a blank email to php-notes+get-97656@lists.php.net to get a copy of this message
in the example below, i found i got an error if the directory was empty or the directory do not exists. <?php foreach (glob("*.txt") as $filename) { echo "$filename size " . filesize($filename) . "\n"; } ?> My solution has: $arrayFiles=glob('c:\text\*.*'); if($arrayFiles){ foreach ($arrayFiles as $filename) { echo "$filename size <br>"; } } else echo"File not found." ---- Manual Page -- http://www.php.net/manual/en/function.glob.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+58197 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+58197&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+58197&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+58197&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+58197&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+58197&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+58197&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+58197&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+58197&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#97656) next »