CodeIgniter Forums

Full Version: Why This Particular Function Structure?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]nc_wolf[/eluser]
Can someone help me understand the following code snippet please? My question is, what is the purpose of passing in a value of false in this function and then immediatley setting it back to true when the function is called. Here is the code (this is the tank_auth authentication library FYI). It just seems like there is no reason to pass in the false at all. It just gets set right back to true. Or, am I missing something about how a function works when its argument is set to a value in the function declaration itself?


Function Call:
Code:
$this->tank_auth->is_logged_in(FALSE)

Function:

Code:
function is_logged_in($activated = TRUE)
{
  return $this->ci->session->userdata('status') === ($activated ? STATUS_ACTIVATED :     STATUS_NOT_ACTIVATED);
}

Many thanks!

nc_wolf