Hi, I’ve got a load of variables which I want to change the values of. The variables are either empty / don’t exist or contain the value ‘YES’. If they contain the value ‘YES’ I want to leave them alone but if they are empty I want to give them the value of ‘NO’.
If i do this it works
[code=php]if (!$var){
$var = “NO”;
}
so I want to write a function that can process multiple variables, and if I do this it doesn’t work:
[code=php]function yesno($value){
if (!$value){
$value = “NO”;
}
}
yesno($var1);
yesno($var2);
I’m assuming that using $value as a placeholder in the function suddenly gets confused with being a real variable when I put $value = “NO”;
I’m sure it’s pretty simple, I just can’t think what to search for as a work around.
Thanks