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

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -