I'm just learning other custom PHP code right now to understand and learn better. In the code below, this is part of a custom class. When I encode using if / else blocks, I format them like this ...
if(!$this->isLoggedIn()){
}
But in the code below it is more like
if (! $this->isLoggedIn())
return false;
Also in the function below you can see that there are a couple of times, what could be the RETURN value . So my question here is when RETURN is called , after that it does not run any code? How does this end the script for this function?
In this case, if this is done ...
if (! $this->isLoggedIn())
return false;
Does code execution continue below?
Here is the function
<?PHP
private function logout($redir=true)
{
if (! $this->isLoggedIn())
return false;
$this->obj->session->sess_destroy();
if ($this->isCookieLoggedIn())
{
setcookie('user','', time()-36000, '/');
setcookie('pass','', time()-36000, '/');
}
if (! $redir)
return;
header('location: '.$this->homePageUrl);
die;
}
?>
source
share