From PHP Manual:
The visibility of a property or method can be defined by prefixing the declaration with the keywords
public
,protected
orprivate
. Class members declaredpublic
can be accessed everywhere. Members declaredprotected
can be accessed only within the class itself and by inherited and parent classes. Members declared asprivate
may only be accessed by the class that defines the member.
class A
{
public $prop1; // accessible from everywhere
protected $prop2; // accessible in this and child class
private $prop3; // accessible only in this class
}
And No, this is not different from other languages implementing the same keywords.
Your assumptions aren't correct. Protected and public members are 'passed on'. Private members aren't. To my knowledge this is typical for many OOP languages.
Private methods and variables cannot be accessed by child classes or externally - only by the class itself. Use Protected if you want the variable accessible by the child but inaccessible to outside classes.