~ubuntu-branches/ubuntu/quantal/php5/quantal

« back to all changes in this revision

Viewing changes to tests/lang/static_variation_002.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Sean Finney
  • Date: 2009-07-01 09:12:10 UTC
  • mto: (0.9.1) (1.1.17 upstream)
  • mto: This revision was merged to the branch mainline in revision 58.
  • Revision ID: james.westby@ubuntu.com-20090701091210-go0h6506p62on17r
Tags: upstream-5.3.0
ImportĀ upstreamĀ versionĀ 5.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--TEST--
 
2
Static variables in methods & nested functions & evals.
 
3
--FILE--
 
4
<?php
 
5
 
 
6
Class C {
 
7
        function f() {
 
8
                static $a = array(1,2,3);
 
9
                eval(' static $k = array(4,5,6); ');
 
10
                
 
11
                function cfg() {
 
12
                        static $a = array(7,8,9);
 
13
                        eval(' static $k = array(10,11,12); ');
 
14
                        var_dump($a, $k);
 
15
                }
 
16
                var_dump($a, $k);
 
17
        }
 
18
}
 
19
$c = new C;
 
20
$c->f();
 
21
cfg();
 
22
 
 
23
Class D {
 
24
        static function f() {
 
25
                eval('function dfg() { static $b = array(1,2,3); var_dump($b); } ');
 
26
        }
 
27
}
 
28
D::f();
 
29
dfg();
 
30
 
 
31
eval(' Class E { function f() { static $c = array(1,2,3); var_dump($c); } }');
 
32
$e = new E;
 
33
$e->f();
 
34
 
 
35
?>
 
36
--EXPECTF--
 
37
array(3) {
 
38
  [0]=>
 
39
  int(1)
 
40
  [1]=>
 
41
  int(2)
 
42
  [2]=>
 
43
  int(3)
 
44
}
 
45
array(3) {
 
46
  [0]=>
 
47
  int(4)
 
48
  [1]=>
 
49
  int(5)
 
50
  [2]=>
 
51
  int(6)
 
52
}
 
53
array(3) {
 
54
  [0]=>
 
55
  int(7)
 
56
  [1]=>
 
57
  int(8)
 
58
  [2]=>
 
59
  int(9)
 
60
}
 
61
array(3) {
 
62
  [0]=>
 
63
  int(10)
 
64
  [1]=>
 
65
  int(11)
 
66
  [2]=>
 
67
  int(12)
 
68
}
 
69
array(3) {
 
70
  [0]=>
 
71
  int(1)
 
72
  [1]=>
 
73
  int(2)
 
74
  [2]=>
 
75
  int(3)
 
76
}
 
77
array(3) {
 
78
  [0]=>
 
79
  int(1)
 
80
  [1]=>
 
81
  int(2)
 
82
  [2]=>
 
83
  int(3)
 
84
}
 
 
b'\\ No newline at end of file'