1--TEST--
2Test array_combine() function : error conditions - empty array
3--FILE--
4<?php
5/* Prototype  : array array_combine(array $keys, array $values)
6 * Description: Creates an array by using the elements of the first parameter as keys
7 *              and the elements of the second as the corresponding values
8 * Source code: ext/standard/array.c
9*/
10
11echo "*** Testing array_combine() : error conditions specific to array_combine() ***\n";
12
13// Testing array_combine by passing empty arrays to $keys and $values arguments
14echo "\n-- Testing array_combine() function with empty arrays --\n";
15var_dump( array_combine(array(), array()) );
16
17// Testing array_combine by passing empty array to $keys
18echo "\n-- Testing array_combine() function with empty array for \$keys argument --\n";
19var_dump( array_combine(array(), array(1, 2)) );
20
21// Testing array_combine by passing empty array to $values
22echo "\n-- Testing array_combine() function with empty array for \$values argument --\n";
23var_dump( array_combine(array(1, 2), array()) );
24
25// Testing array_combine with arrays having unequal number of elements
26echo "\n-- Testing array_combine() function by passing array with unequal number of elements --\n";
27var_dump( array_combine(array(1, 2), array(1, 2, 3)) );
28
29echo "Done";
30?>
31--EXPECTF--
32*** Testing array_combine() : error conditions specific to array_combine() ***
33
34-- Testing array_combine() function with empty arrays --
35array(0) {
36}
37
38-- Testing array_combine() function with empty array for $keys argument --
39
40Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d
41bool(false)
42
43-- Testing array_combine() function with empty array for $values argument --
44
45Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d
46bool(false)
47
48-- Testing array_combine() function by passing array with unequal number of elements --
49
50Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d
51bool(false)
52Done
53