ramblings on PHP, SQL, the web, politics, ultimate frisbee and what else is on in my life
back «  1  2 

Re: Returning early

Well noted. I would go even further:

<?php
function checkSomething($a, $b)
{

if (!$a->doIexist()) {
return false;
}

$a->doSomeStuff();
$b->wowIamSoComplex();
return ($b->stillGoing() || $b->maybeThisWorks());
}

?>

Re: Returning early

Well, actually, replace

if ($b->stillGoing() || $b->maybeThisWorks()) {
return true;
}

return false;

with

return ($b->stillGoing() || $b->maybeThisWorks());

«  1  2