ACCESS MODIFIER | PUBLIC PRIVATE PROTECTED IN PHP

Опубликовано: 13 Апрель 2026
на канале: learners adda
19
0

Public Private Protected
------------------------
Access Modifier allows you to alter the visibility of
any class member(properties and method).

In php there are three scopes for class members.

public
protected and
private
note: default access modifier is public

public Access modifier

public access modifier is open to use and access inside
the class definition as well as outside the class
definition.
Protected access modifier
-------------------------
Protected is only accessible within the class in which it is
defined and its parent or inherited classes.
private access modifier
-----------------------
private is only accessible within the class that defines
it.( it can’t be access outside the class means in
inherited class or directly outside the class).
#php
#accessmodifier
#public
#private
#protected