Below are the following possiblities. Time is for 12 hours
Inputs Output should as
"05:30" True
"asasds" FALSE
"05:30:sads" FALSE
"ADAS:05:40" FALSE
"04:30:40" FALSE
Below is the code that I wrote,
$value = "05:30" ;
if(!preg_match("/(1[012]|0[0-9]):([0-5][0-9])/", $value)){
echo "failed"; exit;
}
echo "passed"; exit;
But it prints as passed if I give the $value = "05:30:asdsa". However I need the output to be "failed".