repo.or.cz
/
hiphop-php.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
global statement removal: hphp/test [7/x]
[hiphop-php.git]
/
hphp
/
test
/
quick
/
static_vars.php
blob
62edb83348acfae889fc5a3f9338f4742556ace6
1
<
?hh
2
3
function
foo
() {
4
static
$a
;
5
$a
++
;
6
print
"foo
$a\n
"
;
7
}
8
9
function
bar
() {
10
static
$a
;
11
$a
+
=
2
;
12
print
"bar
$a\n
"
;
13
}
14
15
function
init_twice
(
$x
) {
16
if
(!
$x
) {
17
static
$a
=
42
;
18
$a
--;
19
print
"init0
$a\n
"
;
20
}
else
{
21
static
$a
=
47
;
22
$a
++
;
23
print
"init1
$a\n
"
;
24
}
25
}
26
27
class
A
{
28
private function
priv
() {
29
static
$x
=
0
;
30
$x
+
=
4
;
31
print
"A::priv
$x\n
"
;
32
}
33
34
function
baz
() {
35
static
$a
;
36
$a
+
=
4
;
37
print
"A::baz
$a\n
"
;
38
$this
->
priv
();
39
}
40
}
41
42
class
B
extends
A
{
43
}
44
45
$a
=
new
A
();
46
$b
=
new
B
();
47
48
foo
();
49
bar
();
50
$a
->
baz
();
51
$b
->
baz
();
52
foo
();
53
bar
();
54
$a
->
baz
();
55
$b
->
baz
();
56
init_twice
(
0
);
57
init_twice
(
0
);
58
init_twice
(
0
);
59
init_twice
(
1
);
60
init_twice
(
1
);
61
init_twice
(
1
);