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
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *