foreach($files as $filename) {
		$file2 = $file2.$filename."<br />";
		echo $file2;
	}

What is wrong with this foreach loop? I just cannot figure it out. It is supposed to take the value from $files and store it in $filename. It's not doing this. It says $filename is an Array. I don't use $filename anywhere else in the entire script. This has me stumped and I'm sure $files is an array.

Also, this isn't the only foreach loop in my script that's doing this.

check the $files array, you may have an array as value. Try print_r to make sure what the contents of the $files array is

grtzzzzz
Michael

Yeah $files is an array, not the value "Array." I'm sure of this.

var_dump($filename); inside the foreach loop and post the output

array(4) { [0]=>  string(25) "./Crookers - Knobbers.mp3" [1]=>  string(61) "./Lil' Wayne/Lil Wayne - Da Drought Vol.3/CD 1/03.Upgrade.mp3" [2]=>  string(61) "./Lil' Wayne/Lil Wayne - Da Drought Vol.3/CD 1/13.Promise.mp3" [3]=>  string(60) "./Lil' Wayne/Lil Wayne - Da Drought Vol.3/CD 2/05.Dipset.mp3" }

Looks like $filename is an array of arrays, try

foreach ($files as $file_list) {
  foreach ($file_list as $file) {
    var_dump($file); echo "\n";
  }
}

Alright that kind of works. However one of the values is getting saved into the array of arrays like 3 times now. Any reason why it would make it an array of arrays? I just want one single array with values.

Nevermind I fixed it! Thanks so much for the help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.