What is the purpose of the function checkPhone in the PHP code provided?

The purpose of the function checkPhone in the PHP code provided is to validate a phone number input by the user. However, the current implementation of the function is incorrect as it is missing the regular expression pattern to validate the phone number format. To fix this issue, we need to update the regular expression pattern used in the function to properly validate phone numbers.

function checkPhone($phone) {
    // Regular expression pattern to validate phone number format
    $pattern = "/^\d{10}$/";

    // Check if the phone number matches the pattern
    if (preg_match($pattern, $phone)) {
        return true;
    } else {
        return false;
    }
}

// Example usage
$phone = "1234567890";
if (checkPhone($phone)) {
    echo "Phone number is valid.";
} else {
    echo "Invalid phone number.";
}