private $name = "parent";
public function __construct()
$this->privateFunction($this->name);
$this->protectedFunction($this->name);
$this->publicFunction($this->name);
private function privateFunction($at)
echo $this->name." : privateFunction @ : ".$at."\n";
protected function protectedFunction($at)
echo $this->name." : protectedFunction @ : ".$at."\n";
public function publicFunction($at)
echo $this->name." : publicFunction @ : ".$at."\n";
class Extension extends MethodVisiblity
public function __construct()
//$this->privateFunction($this->name); //Fatal error: Call to private method MethodVisiblity::privateFunction() from context 'Extension'
$this->protectedFunction($this->name);
$this->publicFunction($this->name);
$var = new MethodVisiblity();
$child = new Extension();