|
Posted by Pedro Graca on 10/07/06 00:17
Joe wrote:
> and of course if their
> is a [...] different [...] way of doing this I'm all ears
I'd use file() instead of fopen(), fread(), feof(), fclose().
I'd use arrays (I *love* arrays).
<?php
$quotes = array();
$dir = opendir($lpath);
while ($f = readdir($dir)) {
if (preg_match('/\.txt$/', $f)) {
$quotes = array_merge($quotes, file($lpath . '/' . $f));
}
}
closedir($dir);
### Remove all blank entries from $quotes
$quotes = array_diff($quotes, array("\n"));
###
### ATTENTION
### The $quotes array may have "holes"
### If you need the keys in order without "holes" uncomment the next line
// $quotes = array_merge($quotes);
?>
--
File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot
Navigation:
[Reply to this message]
|