Return to incdec_property_003.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / classes |
1.1 ! misho 1: --TEST-- ! 2: ZE2 pre increment/decrement property of overloaded object ! 3: --FILE-- ! 4: <?php ! 5: ! 6: class Test { ! 7: private $real_a = 2; ! 8: ! 9: function __set($property, $value) { ! 10: if ($property == "a") { ! 11: $this->real_a = $value; ! 12: } ! 13: } ! 14: ! 15: function __get($property) { ! 16: if ($property == "a") { ! 17: return $this->real_a; ! 18: } ! 19: } ! 20: } ! 21: ! 22: $obj = new Test; ! 23: var_dump($obj->a); ! 24: ++$obj->a; ! 25: var_dump($obj->a); ! 26: echo "---Done---\n"; ! 27: ?> ! 28: --EXPECT-- ! 29: int(2) ! 30: int(3) ! 31: ---Done---