如何在php的父类中使用protected?

In this tutorial(http://www.techflirt.com/tutorials/oop-in-php/visibility-in-php-classes.html), it is said:

Protected: Method or variable with protected visibility can only be access in the derived class. Or in other word in child class. Protected will be used in the process of inheritance.

here(http://php.net/manual/en/language.oop5.visibility.php) it is said:

protected can be accessed only within the class itself and by inherited and parent classes.

We often use Protected in inherited classes, So I wonder how does this work: protected be accessed by parent classes, can anyone give me an example? thanks.

protected really allows any class in the inheritance chain access. There's only one case really where a child property or method would/should be accessed by a parent: the parent declares and calls a protected method and the child overrides it.

class Foo {

    public function bar() {
        $this->baz();
    }

    protected function baz() { }

}

class Child extends Foo {

    protected function baz() {
        echo 'Ha!';
    }

}

When calling $child->bar(), this requires that Foo::bar can access Child::baz. A parent should not in any other way "know" about its children and hence have no need to access something of them.

Protected can be access from the class that defines it any any inherited classes.

For example

 class test {
     protected function foo() {

     }

     public function foobar() {
          $this->foo(); //is allowed here
     }
 }

 class testa extends test {
     public function bar() {
          $this->foo(); //is allowed here
     }
 }