Does this
function doThings(){
if($oh){
return $oh;
}
return false;
}
equal this
function doThings(){
if($oh){
return $oh;
}else{
return false;
}
}
Thank you!
Yes, both do the same. Personally, I prefer to exit a function at the same place. e.g.
function doThings(){
$flag = false;
if($oh){
$flag = $oh;
}
return $flag;
}
In the scenario you outlined above, Yes. Either should work fine. I prefer the first method, less typing and all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With