note 58197 deleted from function.glob by didou
| From: | didou@php.net | Date: | Mon, 15 Jan 2007 23:10:06 +0000 |
| Subject: | note 58197 deleted from function.glob by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-121755@lists.php.net to get a copy of this message | ||
Note Submitter:
----
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."