What's better for my code below |
I am just trying to figure out what is more appropriate these days. What is better having my validate password function at top
PHP Code: public function login($username, $password) { Or like so or wrapped around PHP Code: public function login($username, $password) { PHP Code: public function validate_password($username, $password) {
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
I prefer the first solution. It prevents a lot of nesting if ... elseif... else... statements.
In your verificaton function, you can do this: PHP Code: return password_verify($password, $stored_password); The function itself already returns TRUE or FALSE.
How about
PHP Code: public function login($username, $password) { |
Welcome Guest, Not a member yet? Register Sign In |