1--TEST--
2Test array_values() function : usage variations - Referenced variables
3--FILE--
4<?php
5/* Prototype  : array array_values(array $input)
6 * Description: Return just the values from the input array
7 * Source code: ext/standard/array.c
8 */
9
10/*
11 * Test array_values() when:
12 * 1. Passed an array made up of referenced variables
13 * 2. Passed an array by reference
14 */
15
16echo "*** Testing array_values() : usage variations ***\n";
17
18$val1 = 'one';
19$val2 = 'two';
20$val3 = 'three';
21
22echo "\n-- \$input is an array made up of referenced variables: --\n";
23$input = array(&$val1, &$val2, &$val3);
24var_dump($result1 = array_values($input));
25
26echo "Change \$val2 and check result of array_values():\n";
27$val2 = 'deux';
28var_dump($result1);
29
30echo "Done";
31?>
32
33--EXPECTF--
34*** Testing array_values() : usage variations ***
35
36-- $input is an array made up of referenced variables: --
37array(3) {
38  [0]=>
39  &string(3) "one"
40  [1]=>
41  &string(3) "two"
42  [2]=>
43  &string(5) "three"
44}
45Change $val2 and check result of array_values():
46array(3) {
47  [0]=>
48  &string(3) "one"
49  [1]=>
50  &string(4) "deux"
51  [2]=>
52  &string(5) "three"
53}
54Done
55