summaryrefslogtreecommitdiff
path: root/Zend/tests/objects_032.phpt
blob: b4312ac3f83fc49e39763fd898e1835320562fe5 (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
--TEST--
Covariant return-by-ref constraints
--FILE--
<?php

class A implements ArrayAccess {
    public $foo = array();

    public function &offsetGet($n) {
        return $this->foo[$n];
    }

    public function offsetSet($n, $v) {
    }
    public function offsetUnset($n) {
    }
    public function offsetExists($n) {
    }
}

$a = new A;

$a['foo']['bar'] = 2;

var_dump($a);

?>
--EXPECT--
object(A)#1 (1) {
  ["foo"]=>
  array(1) {
    ["foo"]=>
    array(1) {
      ["bar"]=>
      int(2)
    }
  }
}