File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / tests / classes / dereferencing_001.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:06 2012 UTC (12 years, 4 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

    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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>