In PHP, variables declared inside a function can be accessed outside of that function.
- TRUE
- FALSE
Variables declared inside a function in PHP have a local scope. This means they are only accessible within that specific function. Once the function execution ends, the local variables are destroyed and cannot be accessed from outside the function. In order to access variables across different scopes, you would need to use return statements or pass them as parameters. Learn more: https://www.php.net/manual/en/language.variables.scope.php
Loading...
Related Quiz
- How do you use the $GLOBALS superglobal in PHP?
- In PHP, integers can be specified in decimal (base 10), hexadecimal (base 16), octal (base 8), and ______ (base 2) format.
- Which of the following is a comparison operator in PHP?
- What is the function file_get_contents() useful for?
- You are writing a PHP script and you need to start a session. How would you do this?