Checking for an integer : strval « String « PHP






Checking for an integer

 
if ($_POST['age'] != strval(intval($_POST['age'])) {
    $errors[] = 'Please enter a valid age.';
}
  
  

Related examples in the same category

1.Validating an integer with typecasting