What is access specifiers in php?

Last updated 5 years, 2 months ago | 1494 views 75     5

Tags:- PHP

PHP | Access specifiers

An access specifier is a code element that is used to determine which part of the program is allowed to access a particular variable or other information.


There are three types of access specifiers available in PHP they are:

  1. Private: Members of a class are declared as private and they can be accessed only from that class.
  2. Protected: The class members declared as protected can be accessed from that class or from the inherited class.
  3. Public: The class members declared as public can be accessed from everywhere.