I have roughtly something similar to this:
function get_gender ($gid){
$return= '';
...some code ..
if ($male !== 0 && $female !== 0){
$return = 'mixed';
}else if ($male !== 0 && $female == 0){
$return = 'male';
}
return $return;
}
I know for a fact that one of the condition is met, so i assumed the $return variable would be updated. Though it always comes back empty. Is this a problem of scope ?
$maleand$femaleset to? its not very clear.$male === 0, it will not enter either of those conditions. Do an echo inside theif elseblocks to see if PHP ever gets therereturnfrom theif-elseblock instead of having this$returnvariable? It will save you a couple of steps, a variable and IMO it's cleaner.