What keyword is used in PHP to access a global variable inside a function?

  • local
  • global
  • this
  • super
To access a global variable inside a PHP function, the global keyword is used. By declaring global followed by the variable name within the function, you can access and modify the value of the global variable. This allows you to work with global variables within the function's local scope. 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 *