In the question example there is no problem, request, session and server information in PHP(pure) comes through global variables, in other
These infomations languages come through objects like java request, PHP frameworks also provide objects to manipulate this information.
What is not very correct to do is to access/manipulate a global variable within a function, the correct is to pass this global as the argument of the function, to avoid side effects like functioning break, a function should not suffer interference from anything external should only depend on itself.
Netbeans doesn’t argue anything else, is it? I think this recommendation can change depending on the context.
– rray