1--TEST-- 2ZE2 A private member is 3--FILE-- 4<?php 5 6class base 7{ 8 private $member; 9 10 function __construct() 11 { 12 echo __METHOD__ . "(begin)\n"; 13 $this->member = 'base::member'; 14 $this->test(); 15 echo __METHOD__ . "(end)\n"; 16 } 17 18 function test() 19 { 20 echo __METHOD__ . "\n"; 21 print_r($this); 22 } 23} 24 25class derived extends base 26{ 27 public $member = 'derived::member (default)'; 28 29 function __construct() 30 { 31 echo __METHOD__ . "(begin)\n"; 32 parent::__construct(); 33 parent::test(); 34 $this->test(); 35 $this->member = 'derived::member'; 36 echo __METHOD__ . "(end)\n"; 37 } 38 39 function test() 40 { 41 parent::test(); 42 echo __METHOD__ . "\n"; 43 print_r($this); 44 } 45} 46 47$t = new derived; 48$t->test(); 49unset($t); 50 51echo "Done\n"; 52 53?> 54--EXPECT-- 55derived::__construct(begin) 56base::__construct(begin) 57base::test 58derived Object 59( 60 [member:base:private] => base::member 61 [member] => derived::member (default) 62) 63derived::test 64derived Object 65( 66 [member:base:private] => base::member 67 [member] => derived::member (default) 68) 69base::__construct(end) 70base::test 71derived Object 72( 73 [member:base:private] => base::member 74 [member] => derived::member (default) 75) 76base::test 77derived Object 78( 79 [member:base:private] => base::member 80 [member] => derived::member (default) 81) 82derived::test 83derived Object 84( 85 [member:base:private] => base::member 86 [member] => derived::member (default) 87) 88derived::__construct(end) 89base::test 90derived Object 91( 92 [member:base:private] => base::member 93 [member] => derived::member 94) 95derived::test 96derived Object 97( 98 [member:base:private] => base::member 99 [member] => derived::member 100) 101Done 102