I prefer the following way (in controllers, etc.):
function ($param)
{
if ($param is not valid) {
return false
}
// do the stuff
return true;
}
While my coworker does the opposite: function ($param)
{
if ($param is valid) {
// do the stuff
return true;
}
return false
}
We agreed that none of them is good or wrong, just different approach. I am curious, how do you do, what are your thoughts, pros and cons?