Codice PHP:
function check($er,$type)

    {
        
$l=strlen($er);
        if (empty (
$er))
            {
                
$a="empty";
            }

        else if (!empty(
$er))
            {
                if (
$type=="us" and $l<4)
                    {
                        
$a="long";
                    }

                if (
$type=="ps" and $l<8)
                    {
                        
$a="long";
                    }

                if (
$type=="ms" and !check_mail($er))
                    {
                        
$a="false";
                    }

            }
        else
            {
                
$a="ok";
            }
        return 
$a;
    } 
nel caso in cui $er fosse = a pincopallino e $type=us , $a dovrebbe essere = ok, invece mi restituisce l'errore Undefined variable: a

qualcuno sa dirmi dov'è l'errore?
Grazie