For example in: UserApplePie/pages/profile.php
is: global $mysqli;
However since we are not in an function definition, the variable $mysqli is already in the scope. (It was declared before by the including script.) Therefore the global call is not needed. The only "useful" use case of the global keyword is in an function definition.
And for classes like in: UserApplePie/external/class.newuser.php
a better way of giving a class something this class depends on is via dependency injection, instead of using global. This is considered a standard way of handling this problem. You inject a mysqli instance in the constructor and save it as an class property for later use. Again no global needed (bad practice)
For example in: UserApplePie/pages/profile.php is: global $mysqli; However since we are not in an function definition, the variable $mysqli is already in the scope. (It was declared before by the including script.) Therefore the global call is not needed. The only "useful" use case of the global keyword is in an function definition.
And for classes like in: UserApplePie/external/class.newuser.php a better way of giving a class something this class depends on is via dependency injection, instead of using global. This is considered a standard way of handling this problem. You inject a mysqli instance in the constructor and save it as an class property for later use. Again no global needed (bad practice)