Hi folks,
i have a problem with an array.
First i list out all files wich are in a directory called data and save them into an array like this:
$count = 0;
$ordner = opendir("data");
while($datei = readdir($ordner))
{
if(! is_file("data/$datei"))
continue;
$array[$count] = $datei;
$count++;
}
closedir($ordner);
foreach($array as $wert)
{
print "$wert<p>";
}
It works Fine.
But now i want to open all files with fopen and i wnat to give the $filename the value of ech filenames wich are in the directory. I think the $array isnt fitting to the $filename cause i get an error of non existing file and an endless loop at the fopen point.
here is my try:
while($count > 0)
{
$filename = $array[$count];
$fp = fopen ($filename, "r");
$inhalt = fread ($fp, filesize ($filename));
fclose ($fp);
echo "<HTML><HEAD></HEAD><BODY>";
$data = explode (" : ", $inhalt);
for ($i = 0; $i >= 0; $i++) {
echo "$data[$i]<br>";
}
echo "<HTML><HEAD></HEAD><BODY>";
$count--;
}
error: warning supplied argument is not a valid stream source
im thankfull 4 any help !
PS: sorry 4 bad english, im french