PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
The quickest way I can think of would be to do a glob of the directory to get all the files. Then, loop through each filename and call filemtime() on each file. Then store the filename and modified time (as a UNIX timestamp) in an array. Sort the array to get the information in chronological order.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Im not too sure what you gusy meen, im not being lazy i just dont understand... but could oen of you guys write a quick something up using the basis of:
glob() gives you an array of files, with the filenames being the values of the array
Loop through that resulting array and call filemtime() on each filename
After getting the modified time, make a new array with the keys being the filename, and the value being the timestamp
Call asort() on that array
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
With what I've told you and the info in the manual - you've got everything you need. Just sit down and plug through it - you should be able to figure it out
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
<?php
$dir = "./";
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
echo "filename: $file : filetype: " . filetype($dir . $file) . "\n";
}
closedir($dh);
asort($file);
while (list ($file, ". date ("F d Y H:i:s.", filemtime($file)) = each ($filelist)) {
}
}
?>
Don't use opendir(), readdir(), and closedir() - glob() is much easier. Read my earlier post - I pretty much gave you a step by step list of what to do and in what order.
If what you've got isn't working, start over.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.