class A{
static $var = true;
function f(){
}
}
vs
class A{
function f(){
static $var = true;
}
}
There doesn't seem to be any difference. Are there any advantages of using one over the other?
Note that $var
would be used in the f()
function only. I understand that declaring it in the class header is required if the variable needs to be used in multiple functions