php - How come my time-value comparison is not working properly? -
if ( isset($get['when']) && !empty($get['when']) && !strtotime($get['when']) && strtotime($get['when']) < time() ) renders false forexample strtotime($get['when']) = 2010-12-06, less time() ofc.
if remove && !empty($get['when']) works fine. suggestions why?
your problem !strtotime($get['when']). strtotime returns false on failure , other values considered true statement false. think want:
(strtotime($get['when']) !== false)
Comments
Post a Comment