One of my scripts reads through a temporary directory, looks at the timestamp of each file (included in the filenames), and determines whether they're old enough to delete.
My current challenge is extracting the timestamp from each filename. I'm sure that it can be done with two split() functions, but would optimally like to use one. Here's an example:
$file = "usr/www/temp/1173711918_098f6bcd4621d373cade4e832627b4f6.txt";
$arr = split("_[A-Za-z0-9.]{1,}$", $file);
With the code above, $arr['0'] is "usr/www/temp/1173711918". How would I go about extracting the timestamp using that same split()?