Hello, I'm rewriting a lot of code and have decided to use classes... I'm wondering if this would be considered bad design or not...
Basically in the class I have methods that perform a task, and return true on success, or false on failure. Easy enough. If it returns false however, I want to display errors for the user. The best way I can think of doing this is adding a member variable to the class (an array). With each error encountered it would push them on the array and at the end of the function return false. Then in the code I would check if it returned false, and if so dive into the error member variable array of the class and display them... For example: if($user->login($username, $password)) echo "You have successfully logged in."; else{ foreach($user->loginError as $err){ echo $err . "<br>"; } } This sound like good design? Any suggestions? Thanks... -Dennis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php