Class :Visibility : Public Private

When you define a private member within a public class, this private member is accessible through the inherited classes. If you don't define the private members are not accessible.

<?php
class A {
private $noPrivate="private";
private $myPrivate="private";
public $forall ="Open to all ";
public function showPrivate()
{
echo $this->noPrivate."<br>";
}
}

class test extends A {
public function show()
{
$this->showPrivate();
}
}

$obj=new test();
$obj->show(); // shows "private<br>";
echo $obj->forall;
echo $obj->noPrivate;
?>