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
/
zend_closure_005.php
blob
aabbb17d68afaa0d2a33b65a03ebf4696bd38d58
1
<
?php
2
3
class
A
{
4
private
$x
;
5
6
function
__construct
(
$x
) {
7
$this
->
x
=
$x
;
8
}
9
10
function
getIncer
(
$val
) {
11
return function
()
use
(
$val
) {
12
$this
->
x +
=
$val
;
13
};
14
}
15
16
function
getPrinter
() {
17
return function
() {
18
echo
$this
->
x
.
"
\n
"
;
19
};
20
}
21
22
function
printX
() {
23
echo
$this
->
x
.
"
\n
"
;
24
}
25
}
26
27
$a
=
new
A
(
3
);
28
$incer
=
$a
->
getIncer
(
2
);
29
$printer
=
$a
->
getPrinter
();
30
31
$a
->
printX
();
32
$printer
();
33
$incer
();
34
$a
->
printX
();
35
$printer
();
36
37
unset
(
$a
);
38
39
$incer
();
40
$printer
();
41
42
unset
(
$incer
);
43
$printer
();
44
45
unset
(
$printer
);