I'm reading some books on PHP (specifically "PHP and MySQL Web Development" by Welling and Thomson) and I'm also a fresh undergrad. I was a bit curious why the author decided to choose two different ways to terminate the execution of a function, e.g.
if (!$result) {
throw new Exception('Password could not be changed.');
} else {
return true;
}
For me, this seems a bit inconsistent and it would make more sense to return false and have the caller check the callee's return value and deal with it. Is it common for PHP code to be like this? Is this the type of style expected when using exceptions?