What are the 3 scope levels available in php and how would you define them?



What are the 3 scope levels available in php and how would you define them?..

Answer / Varun Yadav

PHP has three scope levels: Global, Function, and Local/Private.

- Global scope: Variables declared outside of any function have global scope and can be accessed from anywhere within your script.
- Function scope: Variables declared inside a function are only available within that function.
- Local/Private scope (from PHP 5.3 onwards): Use the keyword 'private' to create variables with local scope, which are accessible only within the same class.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

How can you parse files that were not ending with .php by using Apache?

1 Answers  


Where do we use get and post?

1 Answers  


What is php and sql?

1 Answers  


Is jquery better than javascript?

1 Answers  


Is php used anymore?

1 Answers  


What is form validation in php?

1 Answers  


Is php 7.0 stable?

1 Answers  


Which is the best php framework for a beginner?

1 Answers  


Php program to generate fibonacci series?

1 Answers  


What does trim () do in javascript?

1 Answers  


What are traits? How is it used in php?

1 Answers  


What is session management php?

1 Answers  


Categories