I have a list of files in an array where the filename is the key and the value is the last modified date in seconds. They are sorted from oldest to newest.
The files are glob()
'd in, and then sorted this way using
asort($fileNameToLastModified, SORT_NUMERIC);
I use array_shift() to get the oldest file. Unfortunately, it seems to be giving me the value, and there doesn't seem to be a way to get the key.
Would the only way to do that be something like this?
$keys = array_keys($fileNameToLastModified);
$oldest = array_shift($keys);
array_shift($fileNameToLastModified); // to manually chop the first array member off too.
Or is there a built in?
Thanks