How can PHP be used to check if a user input is a numeric value?

To check if a user input is a numeric value in PHP, you can use the is_numeric() function. This function will return true if the input is a numeric value, and false otherwise. You can use this function in an if statement to validate the user input.

$userInput = $_POST['user_input'];

if (is_numeric($userInput)) {
    echo "The input is a numeric value.";
} else {
    echo "The input is not a numeric value.";
}