Return to dereferencing_001.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / classes |
1.1 ! misho 1: --TEST-- ! 2: ZE2 dereferencing of objects from methods ! 3: --SKIPIF-- ! 4: <?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?> ! 5: --FILE-- ! 6: <?php ! 7: ! 8: class Name { ! 9: function Name($_name) { ! 10: $this->name = $_name; ! 11: } ! 12: ! 13: function display() { ! 14: echo $this->name . "\n"; ! 15: } ! 16: } ! 17: ! 18: class Person { ! 19: private $name; ! 20: ! 21: function person($_name, $_address) { ! 22: $this->name = new Name($_name); ! 23: } ! 24: ! 25: function getName() { ! 26: return $this->name; ! 27: } ! 28: } ! 29: ! 30: $person = new Person("John", "New York"); ! 31: $person->getName()->display(); ! 32: ! 33: ?> ! 34: --EXPECT-- ! 35: John