Using if...else... or just if... to determine what is returned
- by Nathan Loding
Which is better?
function test($val = 'a') {
if($val == 'a') {
return true;
}
return false;
}
or
function test($val = 'a') {
if($val == 'a') {
return true;
} else {
return false;
}
}
Effectively, they do the same thing. If $val isn't 'a', the function returns false. Just personal preference?