Question:Which of the following options is/are correct regarding variable scopes in PHP?
A script, function and class
B class, global and script
C global, function and class
D global, script and function
+ ExplanationExplanation:
Global, function and class scope are the three variable scopes for PHP. Variable scope describes where in a program's text the variable may be used, while the extent (or lifetime) describes when in a program's execution a variable has a value. PHP has three types of variable scopes:
1. Function Scope: Variable scope exists within the function where the variable was defined.
2. Global Scope: Variable scope exists everywhere in the PHP script.
3. Class Scope: Variable scope exists within a class where the variable was defined.