Home >Backend Development >PHP Tutorial >Detailed explanation of PHP's public_protected_private permission control
This article introduces a detailed explanation of PHP's public_protected_private permission control. It has a certain reference value. Now I share it with everyone. Friends in need can refer to it
// Compare private, protected, public The difference between the three
/*
private protected public
In this class Y Y
Inside subclass N Y :
public can be called outside the class, and the permissions are the loosest.
protected and private cannot be called outside the class
protected can be accessed within the subclass
public and protected can be accessed within this class
*/
Related recommendations:
privata permission control of PHP
The above is the detailed content of Detailed explanation of PHP's public_protected_private permission control. For more information, please follow other related articles on the PHP Chinese website!