The $GLOBALS superglobal in PHP is an associative array.
- TRUE
- FALSE
The correct option is 1. The $GLOBALS superglobal in PHP is indeed an associative array. It contains references to all global variables currently defined in the global scope of the script. The keys of the $GLOBALS array are the variable names, and the values are references to the corresponding variables. This allows you to access and manipulate global variables from anywhere within the script using the $GLOBALS superglobal. However, it is important to note that modifying the values of global variables directly through the $GLOBALS superglobal can lead to potential issues and make code harder to maintain. It is generally recommended to minimize the use of global variables and follow good coding practices. Learn more: https://www.php.net/manual/en/reserved.variables.globals.php
Loading...
Related Quiz
- What is the main benefit of using OOP in PHP?
- You need to access server-specific information in your PHP script. How would you do this using the $_SERVER superglobal?
- Which of the following statements about variable scope in PHP are correct?
- Which of the following are valid ways to denote a comment in PHP?
- The is_numeric() function in PHP checks if a variable is a(n) ______.