PHP access control modifier
Access control modifiers restrict the functions and classes to be accessed. Following are the list of access control modifiers:
Public: This property or method can be accessed from anywhere on the script.
Private: This property or method cannot be accessed from everywhere. It can only be used by the class or the object it is a part of.
Protected: This property or method can be used by the code in the class it is a part of.
Abstract: This property or method needs to be subclassed and cannot be used directly.
Example:Class employee
{
Public $name;
Private $salary;
}
$emp = new employee;
$emp->name = “emp”;
Print $emp->name