xref: /PHP-7.4/Zend/tests/dereference_008.phpt (revision 782352c5)
1--TEST--
2Testing array dereference with dynamic method name and references
3--FILE--
4<?php
5
6error_reporting(E_ALL);
7
8class foo {
9	public $x = array(1);
10
11	public function &b() {
12		return $this->x;
13	}
14}
15
16$foo = new foo;
17
18$a = 'b';
19var_dump($foo->$a()[0]);
20
21$h = &$foo->$a();
22$h[] = 2;
23var_dump($foo->$a());
24
25?>
26--EXPECT--
27int(1)
28array(2) {
29  [0]=>
30  int(1)
31  [1]=>
32  int(2)
33}
34