xref: /PHP-8.4/ext/standard/tests/array/bug25359.phpt (revision be10050d)
1--TEST--
2Bug #25359 (array_multisort() does not work in a function if array is global or reference)
3--FILE--
4<?php
5
6function does_not_work()
7{
8    global $data; // Remove this line to make array_multisort() work
9
10    $data = array('first', 'fifth', 'second', 'forth', 'third');
11    $sort = array(1, 5, 2, 4, 3);
12    array_multisort($sort, $data);
13
14    var_dump($data);
15}
16
17does_not_work();
18
19?>
20--EXPECT--
21array(5) {
22  [0]=>
23  string(5) "first"
24  [1]=>
25  string(6) "second"
26  [2]=>
27  string(5) "third"
28  [3]=>
29  string(5) "forth"
30  [4]=>
31  string(5) "fifth"
32}
33