The ______ keyword is used in PHP to make a local variable accessible globally.

  • local
  • global
  • this
  • super
The global keyword in PHP is used to make a local variable accessible globally. By using the global keyword followed by the variable name within a function, you can access and modify the value of the variable globally, outside the function's local scope. This allows you to work with local variables in a wider scope. However, it is generally recommended to minimize the use of global variables for better code organization and maintainability. Learn more: https://www.php.net/manual/en/language.variables.scope.php#language.variables.scope.global
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *