1--TEST--
2Test array_unshift() function : basic functionality - associative arrays for 'array' argument
3--FILE--
4<?php
5/*
6 * Testing array_unshift() by giving associative arrays for $array argument
7*/
8
9echo "*** Testing array_unshift() : basic functionality with associative array ***\n";
10
11// Initialise the array
12$array = array('f' => "first", "s" => 'second', 1 => "one", 2 => 'two');
13
14// Calling array_unshift() with default argument
15$temp_array = $array;
16// returns element count in the resulting array after arguments are pushed to
17// beginning of the given array
18var_dump( array_unshift($temp_array, 10) );
19
20// dump the resulting array
21var_dump($temp_array);
22
23// Calling array_unshift() with optional arguments
24$temp_array = $array;
25// returns element count in the resulting array after arguments are pushed to
26// beginning of the given array
27var_dump( array_unshift($temp_array, 222, "hello", 12.33) );
28
29// dump the resulting array
30var_dump($temp_array);
31
32echo "Done";
33?>
34--EXPECT--
35*** Testing array_unshift() : basic functionality with associative array ***
36int(5)
37array(5) {
38  [0]=>
39  int(10)
40  ["f"]=>
41  string(5) "first"
42  ["s"]=>
43  string(6) "second"
44  [1]=>
45  string(3) "one"
46  [2]=>
47  string(3) "two"
48}
49int(7)
50array(7) {
51  [0]=>
52  int(222)
53  [1]=>
54  string(5) "hello"
55  [2]=>
56  float(12.33)
57  ["f"]=>
58  string(5) "first"
59  ["s"]=>
60  string(6) "second"
61  [3]=>
62  string(3) "one"
63  [4]=>
64  string(3) "two"
65}
66Done
67