// Retrieve the value of a request parameter named 'id' $id = (int) $_GET['id']; // Check if the value is a valid integer if (is_int($id)) { // Do something with the integer value }
// Retrieve the value of a request parameter named 'age' $age = (int) $_POST['age']; // Check if the value is a valid integer if (is_int($age)) { // Do something with the integer value }Package Library: The PHP Request Int function is a built-in function in PHP and does not require any package or library installed in order to use it.