File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
tests /
lang /
030.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, 6 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: $this in constructor test
3: --FILE--
4: <?php
5: class foo {
6: function foo($name) {
7: $GLOBALS['List']= &$this;
8: $this->Name = $name;
9: $GLOBALS['List']->echoName();
10: }
11:
12: function echoName() {
13: $GLOBALS['names'][]=$this->Name;
14: }
15: }
16:
17: function &foo2(&$foo) {
18: return $foo;
19: }
20:
21:
22: $bar1 =new foo('constructor');
23: $bar1->Name = 'outside';
24: $bar1->echoName();
25: $List->echoName();
26:
27: $bar1 =& foo2(new foo('constructor'));
28: $bar1->Name = 'outside';
29: $bar1->echoName();
30:
31: $List->echoName();
32:
33: print ($names==array('constructor','outside','outside','constructor','outside','outside')) ? 'success':'failure';
34: ?>
35: --EXPECT--
36: success
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>