Annotation of embedaddon/php/tests/classes/array_access_006.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: ZE2 ArrayAccess and ASSIGN_OP operators (+=)
3: --FILE--
4: <?php
5:
6: class OverloadedArray implements ArrayAccess {
7: public $realArray;
8:
9: function __construct() {
10: $this->realArray = array(1,2,3);
11: }
12:
13: function offsetExists($index) {
14: return array_key_exists($this->realArray, $index);
15: }
16:
17: function offsetGet($index) {
18: return $this->realArray[$index];
19: }
20:
21: function offsetSet($index, $value) {
22: $this->realArray[$index] = $value;
23: }
24:
25: function offsetUnset($index) {
26: unset($this->realArray[$index]);
27: }
28: }
29:
30: $a = new OverloadedArray;
31: $a[1] += 10;
32: var_dump($a[1]);
33: echo "---Done---\n";
34: ?>
35: --EXPECT--
36: int(12)
37: ---Done---
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>