Far Cry Posted December 22, 2012 Share Posted December 22, 2012 <?php class Session { public $loggedin; public function CheckLogin($userid,$username) { if(isset($userid) && isset($username)){ $this->loggedin = true; } else { $this->loggedin = false; } return $this->loggedin; } public function Login(){ if($this->CheckLogin(....?)){ } } } ?> Would I need to pass the variables to the CheckLogin function in the if statement to get the true/false value? If so, how? Link to comment https://forums.phpfreaks.com/topic/272292-php-functions-within-if-statements/ Share on other sites More sharing options...
cpd Posted December 22, 2012 Share Posted December 22, 2012 Of course you would. If a method or function has compulsory parameters you must supply them regardless of where you're calling it from. Link to comment https://forums.phpfreaks.com/topic/272292-php-functions-within-if-statements/#findComment-1400919 Share on other sites More sharing options...
Jessica Posted December 23, 2012 Share Posted December 23, 2012 Your login function will need arguments, especially since its going to do something besides just wrap check login. Link to comment https://forums.phpfreaks.com/topic/272292-php-functions-within-if-statements/#findComment-1400957 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.