Home>

I am creating a site that generates passwords for PHP practice
I added an error code to see if the number of digits is a natural number or whether it exists or not.
Thank you

Error message
{
    "resource": "/c:/xampp/htdocs/password/password.php",
    "owner": "_generated_diagnostic_collection_name_ # 3",
    "code": "undefined",
    "severity": 8,
    "message": "syntax error, unexpected ';'",
    "startLineNumber": 39,
    "startColumn": 29,
    "endLineNumber": 39,
    "endColumn": 1.7976931348623157e + 308
}
{
    "resource": "/c:/xampp/htdocs/password/password.php",
    "owner": "_generated_diagnostic_collection_name_ # 0",
    "code": "undefined",
    "severity": 8,
    "message": "'}' expected.",
    "source": "php",
    "startLineNumber": 39,
    "startColumn": 72,
    "endLineNumber": 39,
    "endColumn": 72
}
{
    "resource": "/c:/xampp/htdocs/password/password.php",
    "owner": "_generated_diagnostic_collection_name_ # 0",
    "code": "undefined",
    "severity": 8,
    "message": "Unexpected 'else'",
    "source": "php",
    "startLineNumber": 43,
    "startColumn": 23,
    "endLineNumber": 43,
    "endColumn": 23
}
{
    "resource": "/c:/xampp/htdocs/password/password.php",
    "owner": "_generated_diagnostic_collection_name_ # 0",
    "code": "undefined",
    "severity": 8,
    "message": "Unexpected '}'",
    "source": "php",
    "startLineNumber": 48,
    "startColumn": 17,
    "endLineNumber": 48,
    "endColumn": 17
}
Applicable source code
<? php
                function sizensuu ($val) {
                    return ctype_digit (filter_var ($val));
                }
                for ($x = 1;$x<= $_GET ['KOSUU'];$x + = 1) {
                    if ($_GET ['KETA']<= 9999999) {
                        if (sizensuu ($_ GET ['KETA']) == true) {
                            $MOJI = array ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', ' b ',' c ',' d ',' e ',' f ',' g ',' h ',' i ',' j ',' k ',' l ',' m ',' n ' , 'o', 'p', 'q', 'r', 's',' t ',' u ',' v ',' w ',' x ',' y ',' z ',' A ',' B ',' C ',' D ',' E ',' F ',' G ',' H ',' I ',' J ',' K ',' L ',' M ' , 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', ' Z ');
                            $password = $MOJI [rand (0, 61)];
                            for ($i = 2;$i<= $_GET ['KETA'];$i ++) {
                                $password = $password. $MOJI [rand (0, 61)];
                            }
                            print ("<textarea>");
                            print ($password);
                            print ("</textarea>");
                        } elif (isset ($_ GET ['KETA'])) {
                            print ("Please enter the number of digits");
                        } else {
                            print ("Please specify the number of digits as a natural number");
                        }
                    } else {
                        print ($_GET ['KETA']. "The digit is too big");
                        print ("<br>");
                        print ("Maximum number of digits, up to 9999999");
                    }
                }
            ?>
Tried

I checked it myself but didn't understand the cause

Supplemental information (FW/tool version etc.)

PHP7
Windows10 1803
Xampp latest version