It is not difficult to do this in PHP. There is no need to call an external shell function.
---------- Post updated at 19:03 ---------- Previous update was at 18:07 ----------
Hints:
filemtime()
unlink()
Hint Hint: PHP online man page for unlink() at php.net has example using filemtime() and unlink() to remove files older than 3600 seconds (last modification time) in a directory.