Solution:1
Yes, you can! The way you were using Function
was wrong (as a bare word without a dollar sign in front it is assumed to either be a reserved word or a constant). Put a dollar sign in front of it so it gets interpreted as a variable.
if (isset($Function)) {
if ($Function == 'A') {
$functionID = '4';
} else if ($Function == 'B'){
$functionID = '11';
}
} else {
$functionID = 0;
}
Please note that Function
is not a string:
- A string would have been
"Function"
. Function
is a reserved wordSome_Function
is a constant (as it’s not reserved)$Function
is a variableSome_Function()
would have been a function call.