![]() |
What's better for my code below - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: General (https://forum.codeigniter.com/forumdisplay.php?fid=1) +--- Forum: Lounge (https://forum.codeigniter.com/forumdisplay.php?fid=3) +--- Thread: What's better for my code below (/showthread.php?tid=67424) |
What's better for my code below - wolfgang1983 - 02-21-2017 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) { RE: What's better for my code below - Wouter60 - 02-21-2017 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. RE: What's better for my code below - kidino - 03-15-2017 How about PHP Code: public function login($username, $password) { |