A variable declared outside all functions in PHP has a global scope and can be accessed anywhere in the script.

  • TRUE
  • FALSE
Yes, the statement is true. A variable declared outside all functions in PHP has a global scope. It means the variable is accessible from anywhere within the script, including inside functions. These global variables retain their values throughout the execution of the script. However, it is generally recommended to use global variables sparingly and follow good programming practices to avoid potential issues related to variable scoping 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 *