A variable declared outside all functions in PHP is considered to have a ______ scope.

  • Local
  • Global
  • Static
  • Super
A variable declared outside all functions in PHP is considered to have a global scope. It means that the variable is accessible from anywhere in the PHP script, including inside functions. Global variables are defined outside of any function and can be accessed and modified throughout the entire script. However, it's generally recommended to use global variables sparingly and follow good programming practices to avoid potential issues related to variable scoping. 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 *