Reputation: 15006
if (
isset($get['when'])
&& !empty($get['when'])
&& !strtotime($get['when'])
&& strtotime($get['when']) < time()
)
Renders false for forexample strtotime($get['when']) = 2010-12-06
, this is less than time() ofc.
If I remove && !empty($get['when'])
it works fine. Any suggestions why?
Upvotes: 0
Views: 75
Reputation: 91734
Your problem is !strtotime($get['when'])
. strtotime
only returns false on failure and all other values are considered true
so your statement is always false. I think you want:
(strtotime($get['when']) !== false)
Upvotes: 1
Reputation: 872
This is realy interesting part of code green
&& !strtotime($get['when']) && strtotime($get['when'])
Upvotes: 1