?> --FILE-- <?php class Bar { public function pub() { $this->priv(); } private function priv() { echo "Bar::priv()\n"; } } class Foo extends Bar { public function priv() { echo "Foo::priv()\n"; } } $obj = new Foo(); $obj->pub(); $obj->priv(); echo "Done\n"; ?> --EXPECTF-- Bar::priv() Foo::priv() Done
<?php class Bar { public static function pub() { Bar::priv(); } private static function priv() { echo "Bar::priv()\n"; } } class Foo extends Bar { public static function priv() { echo "Foo::priv()\n"; } } Foo::pub(); Foo::priv(); echo "Done\n";