Advanced Array Processing

Advanced Array Processing

Requirement:
I have dumped a bunch of images in 1 directory folder
i have an array that holds all of those images
from this array of images
i want to be able to create photosets based on each image’s file modification date
i want to be able to arrange them seperately from that array

example:

$photoset1_10/09/2010 = array()
$photoset2_05/10/2010 = array()
$photoset3_31/11/2010 = array()
$photoset3_25/12/2010 = array()

$storage = array();

$storage[0] = $photoset1_10/09/2010
$storage[1] = $photoset2_05/10/2010
$storage[2] = $photoset3_31/11/2010
$storage[3] = $photoset3_25/12/2010

instead of the user having to scroll through a large list of images they can jump to a photoset
which one of the built in PHP Iterators will allow me to do this …
i know i could put the files back manually into folders…but i want the code to do the work…

any ideas would be great

//===============================================
Code
//==============================================

<?php include 'G:/xampplite/htdocs/PHP_Operations/Directory_Operations/dynamic_gallery_class.php'; function getFileModTime($directory){ $dg = new DynamicGallery; $dg->open_read_directory($directory); $files = $dg->getFiles(); for($i=0; $i < count($files); $i++ ){ $modDate[] = date ("dmY", filemtime($files[$i])); } return $modDate; } function getFileByDate($files){ for($i=0; $i < count($files); $i++){ if($files[$i]===$files[0]){ $results[] = $files[$i]; } else{ } } echo "
";
		print_r($results);

	}	
	

	
	
	
		$fileresults = getFileModTime("G:/xampplite/htdocs/Content/Models/penny_all");
		getFileByDate($fileresults);
	
	
	echo "
";
	print_r($fileresults);

i guess i solved it my self …there is already a powerful built in function that does what i wanted…
;D

[php] array_count_values();

function test($myarray){
	print_r(array_count_values($myarray));
}

[/php]

Array
(
[10092010] => 307
[13092010] => 335
[16092010] => 332
[17092010] => 355
[22092010] => 308
[24092010] => 273
[28092010] => 255
[01102010] => 258
[04102010] => 283
[07102010] => 185
)

Sponsor our Newsletter | Privacy Policy | Terms of Service