What is the scope of a variable that is declared within a PHP function?

  • Local
  • Global
  • Static
  • Dynamic
In PHP, a variable that is declared within a function has a local scope. This means it is only accessible within that function. Once the function finishes execution, the variable is destroyed and cannot be accessed from outside the function. This helps encapsulate variables and prevent naming conflicts. 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 *