I have a user registration script. At one stage I call a method three times. Once to check if the method returns true, else if it doesn’t, does it return a string (containing an error message) and if it does get the returned string and place it in a variable.
Is the a more productive way of doing this so that I only need to call the method once? But still get all answers I need?
Heres the code:
//check thumbnail is present and good
if($register->checkThumb()){
//send image to permanent image directory
$register->moveUploadedImage();
//if the thumbnail failed validation put the error message in variable
}else if(is_string($register->checkThumb())){
$message = $register->checkThumb();
}
1 Answer