summaryrefslogtreecommitdiff
path: root/ext/spl/tests/array_003.phpt
blob: d5317a11c514eb82c36e59ced28c34bdc5684f0a (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
60
61
62
63
--TEST--
SPL: ArrayObject from object
--FILE--
<?php

// This test also needs to exclude the protected and private variables 
// since they cannot be accessed from the external object which iterates 
// them.

class test
{
	public    $pub = "public";
	protected $pro = "protected";
	private   $pri = "private";

	function __construct()
	{
		$this->imp = "implicit";
	}
};

$test = new test;
$test->dyn = "dynamic";

print_r($test);

$object = new ArrayObject($test);

print_r($object);

foreach($test as $key => $val)
{
	echo "$key => $val\n";
}

?>
===DONE===
<?php exit(0); ?>
--EXPECT--
test Object
(
    [pub] => public
    [pro:protected] => protected
    [pri:test:private] => private
    [imp] => implicit
    [dyn] => dynamic
)
ArrayObject Object
(
    [storage:ArrayObject:private] => test Object
        (
            [pub] => public
            [pro:protected] => protected
            [pri:test:private] => private
            [imp] => implicit
            [dyn] => dynamic
        )

)
pub => public
imp => implicit
dyn => dynamic
===DONE===