Loading…

What is the difference between public, protected and private?

PHP has three access modifiers such as public, private and protected.

  • public scope of this variable or function is available from anywhere, other classes and instances of the object.
  • private scope of this variable or function is available in its class only.
  • protected scope of this variable or function is available in all classes that extend the current class including the parent class.

Suggest An Answer

No suggestions avaliable!

Latest post from PHP interview questions

Ask Question