xref: /PHP-8.1/ext/standard/tests/array/bug69723.phpt (revision f8d79582)
1--TEST--
2Bug #69723 (Passing parameters by reference and array_column)
3--FILE--
4<?php
5function byReference( & $array){
6    foreach($array as &$item){
7        $item['nanana'] = 'batman';
8        $item['superhero'] = 'robin';
9    }
10}
11
12$array = [
13    [
14    'superhero'=> 'superman',
15    'nanana' => 'no nana'
16    ],
17    [
18    'superhero'=> 'acuaman',
19    'nanana' => 'no nana'
20    ],
21
22    ];
23
24var_dump(array_column($array, 'superhero'));
25byReference($array);
26var_dump(array_column($array, 'superhero'));
27?>
28--EXPECT--
29array(2) {
30  [0]=>
31  string(8) "superman"
32  [1]=>
33  string(7) "acuaman"
34}
35array(2) {
36  [0]=>
37  string(5) "robin"
38  [1]=>
39  string(5) "robin"
40}
41