Return something as well as the FALSE

wastelandsz

New Member
I am building a library and I want to know If there is a possibility and how the best approach could be done here: Basically I would want to have some different messages that I could display depending on the result in the class.Psuedo:\[code\]public function login($username, $password) { //query if (password hash is verified) if (active == false) (some sort of MESSAGE HERE! like "User is not activate...") return false if banned some sort of message return false else message (wrong username or password) return false}And then on the loginif (login(username, password)) successfully redirectelse display the message\[/code\]How is the way to implement this in a good approach? I assume I would need some sort of variable that I would give a value and then I would have some method() that would return a error message if it is set, Am I right so far? How should I do it?
 
Back
Top