1--TEST--
2Test shuffle() function : basic functionality -  with associative array
3--FILE--
4<?php
5/*
6* Test behaviour of shuffle when an associative array is
7* passed to the 'array_arg' argument and check for the
8* changes in the input array by printing the input array
9* before and after shuffle() function is applied on it
10*/
11
12echo "*** Testing shuffle() : with associative array ***\n";
13
14// Initialise the associative array
15$array_arg = array(
16  'one' => 1, 2 => 02, 'three' => 3,
17   4 => 4, '#5' => 5, 'SIX' => 6,
18  "seven" => 0x7, "#8" => 012, "nine" => 9
19);
20
21// printing the input array before the shuffle operation
22echo "\n-- input array before shuffle() function is applied --\n";
23var_dump( $array_arg );
24
25// applying shuffle() function on the input array
26echo "\n-- return value from shuffle() function --\n";
27var_dump( shuffle($array_arg) );  // prints the return value from shuffle() function
28
29echo "\n-- resultant array after shuffle() function is applied --\n";
30var_dump( $array_arg );
31
32echo "Done";
33?>
34--EXPECTF--
35*** Testing shuffle() : with associative array ***
36
37-- input array before shuffle() function is applied --
38array(9) {
39  ["one"]=>
40  int(1)
41  [2]=>
42  int(2)
43  ["three"]=>
44  int(3)
45  [4]=>
46  int(4)
47  ["#5"]=>
48  int(5)
49  ["SIX"]=>
50  int(6)
51  ["seven"]=>
52  int(7)
53  ["#8"]=>
54  int(10)
55  ["nine"]=>
56  int(9)
57}
58
59-- return value from shuffle() function --
60bool(true)
61
62-- resultant array after shuffle() function is applied --
63array(9) {
64  [0]=>
65  int(%d)
66  [1]=>
67  int(%d)
68  [2]=>
69  int(%d)
70  [3]=>
71  int(%d)
72  [4]=>
73  int(%d)
74  [5]=>
75  int(%d)
76  [6]=>
77  int(%d)
78  [7]=>
79  int(%d)
80  [8]=>
81  int(%d)
82}
83Done
84