-2

I have the following codes.

$days = 7;   

// Check if the file is older than X days old  
if (filemtime($path.$file) < ( time() - ( $days * 24 * 60 * 60 ) ) )  
{  
    // Do the deletion  
    unlink($path.$file);  
}

I want to change $days to $minute, how do I go about changing it?

Jia Jian Goi
  • 1,415
  • 3
  • 20
  • 31

2 Answers2

0
$minute = 1440 * $days;
// there are 1440 minutes in a day

I have no idea if this is what you were asking.. but it seems appropriate.

bonCodigo
  • 14,268
  • 1
  • 48
  • 91
0

If you want to check if the file is older than x minutes, the following codes might apply.

$minutes = 15;

// Check if the file is older than x minutes
if (filemtime($path.$file) < ( time() - ( $minutes * 60 ) ) ) {  
    // Do the deletion  
    unlink($path.$file);  
}
Jia Jian Goi
  • 1,415
  • 3
  • 20
  • 31