xref: /PHP-8.2/Zend/tests/dereference_006.phpt (revision f8d79582)
1--TEST--
2Testing array dereference and references
3--FILE--
4<?php
5
6error_reporting(E_ALL);
7
8function &foo(&$foo) {
9    return $foo;
10}
11
12$a = array(1);
13foo($a)[0] = 2;
14var_dump($a);
15
16foo($a)[] = 3;
17var_dump($a);
18
19?>
20--EXPECT--
21array(1) {
22  [0]=>
23  int(2)
24}
25array(2) {
26  [0]=>
27  int(2)
28  [1]=>
29  int(3)
30}
31