dimanche 2 août 2015

Is it wise to use exit() after each if statement?

I've seen some php scripts that has exit() after each if statement. example:

if (empty($username)) {
   echo "error username is invalid";
  exit();
} else if (empty($password)) {
   echo "error password is invalid";
  exit();
} else {
  login($username, $password);
}

function login($u, $p)
{
   //do something here
   exit();
}

Aucun commentaire:

Enregistrer un commentaire