I'm new to php and I can't understand why is it that the variable "cons" isn't recognized by the the compiler when used inside the function "func", in the following code:
$cons = 1;
function plusCons($num) {
return $num + $cons;
}
is it impossible to use global variables inside of a function's scope?
global $cons;inside function. See: php.net/manual/en/language.variables.scope.phpfunction plusCons($num) use($cons) { ...