[thelist] writing array contents to file

Aaron Vegh aaronvegh at gmail.com
Sun Jun 22 07:28:51 CDT 2008


Hi there,
I have an array that contains directory names, file names and file
contents. I need to write a function that iterates through the array,
and for each array key that doesn't contain a "." write a directory
instead of a file. Here's a simplified array that's structured
similarly to the target array:

$array = array(
			"setup"=>array(
				"file1.txt"=>"file1 contents",
				"file2.txt"=>"file2 contents"),
			"images"=>array(
				"image1.gif"=>"image1contents",
				"image2.gif"=>"image2contents"),
			"library"=>array(
				"settings_conf"=>array(
					"conf1.txt"=>"conf1 contents",
					"conf2.txt"=>"conf2 contents"),
				"settings_conf1.txt"=>"contents"),
			"config.txt"=>"configuration contents");

I've made a number of attempts, but I can't seem to get it figured
out! Any help would be appreciated. :-)
Cheers,
Aaron.

-- 
Aaron Vegh, Principal
Innoveghtive Inc.
P: (647) 477-2690
C: (905) 924-1220
www.innoveghtive.com
www.website-in-a-day.com



More information about the thelist mailing list