1--TEST--
2Test rsort() function : usage variations - referenced variables
3--FILE--
4<?php
5/* Prototype  : bool rsort(array &$array_arg [, int $sort_flags])
6 * Description: Sort an array in reverse order
7 * Source code: ext/standard/array.c
8 */
9
10/*
11 * Test behaviour of rsort() when:
12 * 1. passed an array of referenced variables
13 * 2. $array_arg is a reference to another array
14 * 3. $array_arg is passed by reference
15 */
16
17echo "*** Testing rsort() : variation ***\n";
18
19$value1 = 100;
20$value2 = 33;
21$value3 = 555;
22
23// an array containing integer references
24$unsorted_numerics =  array( &$value1 , &$value2, &$value3);
25
26echo "\n-- 'flag' value is defualt --\n";
27$temp_array = $unsorted_numerics;
28var_dump( rsort($temp_array) );
29var_dump( $temp_array);
30
31echo "\n-- 'flag' = SORT_REGULAR --\n";
32$temp_array = &$unsorted_numerics;
33var_dump( rsort($temp_array, SORT_REGULAR) );
34var_dump( $temp_array);
35
36echo "Done";
37?>
38--EXPECT--
39*** Testing rsort() : variation ***
40
41-- 'flag' value is defualt --
42bool(true)
43array(3) {
44  [0]=>
45  &int(555)
46  [1]=>
47  &int(100)
48  [2]=>
49  &int(33)
50}
51
52-- 'flag' = SORT_REGULAR --
53bool(true)
54array(3) {
55  [0]=>
56  &int(555)
57  [1]=>
58  &int(100)
59  [2]=>
60  &int(33)
61}
62Done
63