The last line in the example:
class MyClass { public $public = 'Public'; protected $protected = 'Protected'; private $private = 'Private'; function printHello() { echo $this->public; echo $this->protected; echo $this->private; } } $obj = new MyClass(); echo $obj->public; // Works echo $obj->protected; // Fatal Error echo $obj->private; // Fatal Error $obj->printHello(); // Shows Public, Protected and Private does not show public, protected, and private: Tried on Chrome and Safari on macOS Sierra — no result on either. Source: http://php.net/manual/en/language.oop5.visibility.php <http://php.net/manual/en/language.oop5.visibility.php>