post #11 of 11
Meh... I thought I'd debug mine. There were a few problems, (adding an $ to the count() function doesn't help, btw... the count() function is used to count the number of keys in an array), it was the variable inside the function that was missing the "$," and a few other variables were missing the "$" too. Oh well, I didn't get much sleep yesterday.

Code:
<?php
// Set variables.
$dir = "C:/Documents and Settings/Administrator/My Documents/";
$files = scandir($dir);
$i = 1;
$count = count($files); // Remember, normally minus one, except for the while case, we aren't doing <= or >=.

// Open file.
$file = "file.txt";
$fh = fopen($file, 'w') or die("Error: Can't open file.");

// Begin while case.
While ($count > $i) {
$i++;
$filename = explode(".", $files[$i]);
$file_contents .=  $files[$i]. "=+:" .$filename[0]. "=+::" .($i - 1). "\
";
}
fwrite($fh, $file_contents);
fclose($fh);
?>
Skips the first two so-called files "." and ".." like BFRD's does, I think.

W/e