How can PHP code be modified to allow commas in addition to numbers in a form checker function?

To allow commas in addition to numbers in a form checker function, you can modify the regular expression used to validate the input. Simply update the regular expression pattern to accept commas as well as numbers. This will allow users to input numbers with commas in the form field.

// Original form checker function
function checkInput($input) {
    if (preg_match('/^\d+$/', $input)) {
        return true;
    } else {
        return false;
    }
}

// Modified form checker function to allow commas
function checkInput($input) {
    if (preg_match('/^[\d,]+$/', $input)) {
        return true;
    } else {
        return false;
    }
}