Which type of variable in PHP is accessible anywhere in the script?

  • Local
  • Global
  • Static
  • Super
In PHP, a global variable is accessible anywhere in the script. It can be accessed from within functions, outside functions, and across different files. Global variables have a global scope, meaning they can be accessed and modified from any part of the script. However, it's generally recommended to use global variables sparingly and follow good programming practices to avoid potential issues. 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 *