I read some books on PHP (notably Welling and Thomson's "PHP and MySQL Web Development"), and I am also a fresh teenager. I was a little curious why the author decided to choose two different ways to stop the function, for example.
if (!$result) {
throw new Exception('Password could not be changed.');
} else {
return true;
}
For me, this seems a little inconsistent, and it would be wiser to return false, and the caller checks the returned value of the called subscriber and processes it. Is it common for PHP code? Is this type of style expected when using exceptions?
source
share