summaryrefslogtreecommitdiff
path: root/ext/spl/tests/array_003.phpt
blob: de4ce30f91f7161000ed37898bc39f8336b57254 (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); ?>
--EXPECTF--
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===