I have the following array:
$Output = Array
(
[0] => 2013-08-28 13:04:50-05:00
[1] => 2013-08-28 18:31:29-05:00
[2] => 2013-08-30 15:08:23-05:00
[3] => 2013-08-30 21:45:48-05:00
[4] => 2013-08-31 16:57:50-05:00
)
Now i need to convert each element to a string so I can compare it with these variables:
$hr24 = strtotime(date('Y-m-d H:i:sP',strtotime("-1 days")));
$hr72 = strtotime(date('Y-m-d H:i:sP',strtotime("-3 days")));
So what I want to do is, if the array element is over 24hr, write it to a TXT file, and if is over 72hr write to a different one. So i have this:
$OutputStr = serialize($Output);
$OutputStr = strtotime($OutputStr);
if ($OutputStr > $hr24) {
file_put_contents('/folder/test/test24hr_log.txt', print_r($OutputStr, true));
}
elseif ($OutputStr > $hr72) {
file_put_contents('/folder/test/test72hr_log.txt', print_r($OutputStr, true));
}
But is not giving me any answer, does anybody have an idea? I dont know if im doing the right comparison for each element. Any help is appreciated thanks!
var_dump($OutputStr). Then think.