Protected Visibility¶
The protected keyword is part of the three keywords to define visibility of a method, property or constant. It is the strictest level of visibility : it restricts usage to the current class and its parents and children.
<?php
class x {
protected const X = 1;
public function method() {
echo self::X;
}
}
?>
Related : Final Keyword, Visibility, Private Visibility, Public Visibility, Var