• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why This Particular Function Structure?

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:


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

Many thanks!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.