I need to check if a string contains NO other characters except numbers (0,1,2,3,4,5,6,7,8,9).
I’m expecting the user to input a time (12:00). I explode() the input to seperate the hours and minutes. I now need to make sure the time is an actual time value.
$time = explode(":",$time);
if ($time['0'] > 12 || $time['0'] < 1 || not_actual_numbers)
{
//error: not valid hour
echo("error: time val hour is bad");
}
You can use
is_int