How verify if input is numeric

is_numeric only checks 1 variable.

You have to write a if statement like the following:

    if(is_numeric($valortotal) && is_numeric($porcentagem1) && is_numeric($porcentagem2) && is_numeric($porcentagem3) && is_numeric($porcentagem4))
    {
        echo "Por favor, digite apenas nĂºmeros";
    }

Note: This only echo’s “Por favor, digite apenas nĂºmeros” if all the variables are numeric.

Leave a Comment