Validating an integer with typecasting : strval « String « PHP






Validating an integer with typecasting

 
<?php
if ($_POST['rating'] != strval(intval($_POST['rating']))) {
   print 'Your rating must be an integer.';
}
?>
  
  








Related examples in the same category

1.Checking for an integer