Google News
logo
PHP - Interview Questions
What is meant by public, private, protected, static and final scopes?
Public : Variables, classes, and methods which are declared public can be accessed from anywhere.

Private : Variables, classes and methods which are declared private can be accessed by the parent class only.

Protected : Variables, classes, and methods which are declared protected can be accessed by the parent and child classes only.

Static : The variable which is declared static can keep the value after losing the scope.

Final : This scope prevents the child class to declare the same item again.
Advertisement