0

I got this error syntax error, unexpected 'for' T_FOR for a function that uses a for loop. However, I can't point out what's the mistake. All the semicolons and variables are in place supposedly

function uname_syntax($uname)
{
    $alphacount = 0

    for ($i = 0, $n = strlen($uname); $i < $n; $i++)
    {
        if(!ctype_alpha($uname[$i]))
        {
            if(!is_numeric($uname[$i]))
            {
                if($uname[$i] != '_')
                {
                    return false;
                }
            }
        }
        else
        {
            $alphacount++;
        }
    }
    if($alphacount == 0)
    {
        return false;
    }
    return true;
 }
2

Not all of them! $alphacount = 0 :)

1
  • Thanks man. It worked :)
    – A.Emad
    Sep 12 '16 at 22:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .