A variable declared within a function in PHP has a ______ scope.

  • Local
  • Global
  • Static
  • Dynamic
A variable declared within a function in PHP has a local scope. It means that the variable is only accessible within that specific function. It cannot be accessed outside of the function or in other functions. This helps in encapsulation and prevents naming conflicts with other variables in different functions. Learn more: https://www.php.net/manual/en/language.variables.scope.php
Add your answer
Loading...

Leave a comment

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