Recent Posts

Showing posts with label private. protected. Show all posts
Showing posts with label private. protected. Show all posts

When use public, private or protected PHP

You use:

  • public scope to make that variable/function available from anywhere, other classes and instances of the object.
  • private scope when you want your variable/function to be visible in its own class only.
  • protected scope when you want to make your variable/function visible in all classes that extend current class including the parent class.


More: (For comprehensive information): http://php.net/manual/en/language.oop5.visibility.php