1--TEST--
2Test array_pad() function : usage variations - two dimensional array for 'pad_value' argument
3--FILE--
4<?php
5/*
6* Passing two dimensional array to $pad_value argument and testing whether
7* array_pad() behaves in an expected way with the other arguments passed to the function.
8* The $input and $pad_size arguments passed are fixed values.
9*/
10
11echo "*** Testing array_pad() : Passing 2-d array to \$pad_value argument ***\n";
12
13// initialize the $input and $pad_size argument
14$input = array(1, 2, 3);
15$pad_size = 5;
16
17// initialize $pad_value
18$pad_value = array (
19  array(1),
20  array("hello", 'world'),
21  array("one" => 1, 'two' => 2)
22);
23
24var_dump( array_pad($input, $pad_size, $pad_value) );  // positive 'pad_value'
25var_dump( array_pad($input, -$pad_size, $pad_value) );  // negative 'pad_value'
26
27echo "Done";
28?>
29--EXPECT--
30*** Testing array_pad() : Passing 2-d array to $pad_value argument ***
31array(5) {
32  [0]=>
33  int(1)
34  [1]=>
35  int(2)
36  [2]=>
37  int(3)
38  [3]=>
39  array(3) {
40    [0]=>
41    array(1) {
42      [0]=>
43      int(1)
44    }
45    [1]=>
46    array(2) {
47      [0]=>
48      string(5) "hello"
49      [1]=>
50      string(5) "world"
51    }
52    [2]=>
53    array(2) {
54      ["one"]=>
55      int(1)
56      ["two"]=>
57      int(2)
58    }
59  }
60  [4]=>
61  array(3) {
62    [0]=>
63    array(1) {
64      [0]=>
65      int(1)
66    }
67    [1]=>
68    array(2) {
69      [0]=>
70      string(5) "hello"
71      [1]=>
72      string(5) "world"
73    }
74    [2]=>
75    array(2) {
76      ["one"]=>
77      int(1)
78      ["two"]=>
79      int(2)
80    }
81  }
82}
83array(5) {
84  [0]=>
85  array(3) {
86    [0]=>
87    array(1) {
88      [0]=>
89      int(1)
90    }
91    [1]=>
92    array(2) {
93      [0]=>
94      string(5) "hello"
95      [1]=>
96      string(5) "world"
97    }
98    [2]=>
99    array(2) {
100      ["one"]=>
101      int(1)
102      ["two"]=>
103      int(2)
104    }
105  }
106  [1]=>
107  array(3) {
108    [0]=>
109    array(1) {
110      [0]=>
111      int(1)
112    }
113    [1]=>
114    array(2) {
115      [0]=>
116      string(5) "hello"
117      [1]=>
118      string(5) "world"
119    }
120    [2]=>
121    array(2) {
122      ["one"]=>
123      int(1)
124      ["two"]=>
125      int(2)
126    }
127  }
128  [2]=>
129  int(1)
130  [3]=>
131  int(2)
132  [4]=>
133  int(3)
134}
135Done
136