1--TEST--
2ZE2 ArrayAccess and ASSIGN_OP operators (.=)
3--FILE--
4<?php
5
6class Peoples implements ArrayAccess {
7	public $person;
8
9	function __construct() {
10		$this->person = array(array('name'=>'Foo'));
11	}
12
13	function offsetExists($index) {
14		return array_key_exists($this->person, $index);
15	}
16
17	function offsetGet($index) {
18		return $this->person[$index];
19	}
20
21	function offsetSet($index, $value) {
22		$this->person[$index] = $value;
23	}
24
25	function offsetUnset($index) {
26		unset($this->person[$index]);
27	}
28}
29
30$people = new Peoples;
31
32var_dump($people->person[0]['name']);
33$people->person[0]['name'] = $people->person[0]['name'] . 'Bar';
34var_dump($people->person[0]['name']);
35$people->person[0]['name'] .= 'Baz';
36var_dump($people->person[0]['name']);
37
38echo "===ArrayOverloading===\n";
39
40$people = new Peoples;
41
42var_dump($people[0]['name']);
43$people[0]['name'] = 'FooBar';
44var_dump($people[0]['name']);
45$people[0]['name'] = $people->person[0]['name'] . 'Bar';
46var_dump($people[0]['name']);
47$people[0]['name'] .= 'Baz';
48var_dump($people[0]['name']);
49
50?>
51===DONE===
52--EXPECTF--
53string(3) "Foo"
54string(6) "FooBar"
55string(9) "FooBarBaz"
56===ArrayOverloading===
57string(3) "Foo"
58
59Notice: Indirect modification of overloaded element of Peoples has no effect in %sarray_access_008.php on line 40
60string(3) "Foo"
61
62Notice: Indirect modification of overloaded element of Peoples has no effect in %sarray_access_008.php on line 42
63string(3) "Foo"
64
65Notice: Indirect modification of overloaded element of Peoples has no effect in %sarray_access_008.php on line 44
66string(3) "Foo"
67===DONE===
68