blob: 859a5f7b6c10ada6c5bbe7baad5e1788e99ad0b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
--TEST--
ZE2 foreach and property visibility
--FILE--
<?php
class base
{
public $a=1;
protected $b=2;
private $c=3;
function f()
{
foreach($this as $k=>$v) {
echo "$k=>$v\n";
}
}
}
class derived extends base
{
}
$o = new base;
$o->d = 4;
echo "===base::function===\n";
$o->f();
echo "===base,foreach===\n";
foreach($o as $k=>$v) {
echo "$k=>$v\n";
}
$o = new derived;
$o->d = 4;
echo "===derived::function===\n";
$o->f();
echo "===derived,foreach===\n";
foreach($o as $k=>$v) {
echo "$k=>$v\n";
}
?>
--EXPECT--
===base::function===
a=>1
b=>2
c=>3
d=>4
===base,foreach===
a=>1
d=>4
===derived::function===
a=>1
b=>2
c=>3
d=>4
===derived,foreach===
a=>1
d=>4
|