How to check time correctly?
Posted: Fri Sep 06, 2002 5:14 am
I'm using this function to check time:
But it returns 1 if I input time that has many zeros like 0002.22. I don't want that to be ok. (Don't ask why
) Is there something I'm missing?
thanks
-9902468
Code: Select all
//function that checks time syntax (hh.mm), correct values etc..
function check_time($time){
$return = 0;
if( ereg("(ї0-9]{1,2})\.(ї0-9]{1,2})", $time) ){
$time_info = explode(".", $time);
if($time_infoї0] < 24 && $time_infoї0] >= 0 && $time_infoї1] < 60 && $time_infoї1] >= 0){
$return = 1;
}else{
$return = 0;
}
}else{
$return = 0;
}
return $return;
}thanks
-9902468