This article brings the content is about PHP in the simple difference between public&private&protect and usage introduction, there is a certain reference value, the need for friends can refer to, I hope to help you.
Public "common"
Can be called from anywhere in the program (within the class, outside the Class) by other classes and objects. Subclasses can inherit and use all public members in the parent class.
Private "privately-owned"
Variables and methods that are modified by private can only be called and modified within the class in which they are located, and cannot be accessed outside of the class. It is also not possible in subclasses.
If called directly, an error occurs.
Protect "protected"
Class members decorated with protected can be called in this class and in subclasses, but cannot be called anywhere else.
Related recommendations:
PHP5 in public,private,protected
public,private,protected Differences in PHP class, and examples