1--TEST--
2Test array_combine() function : error conditions - empty array
3--FILE--
4<?php
5echo "*** Testing array_combine() : error conditions specific to array_combine() ***\n";
6
7// Testing array_combine by passing empty arrays to $keys and $values arguments
8echo "\n-- Testing array_combine() function with empty arrays --\n";
9var_dump( array_combine(array(), array()) );
10
11// Testing array_combine by passing empty array to $keys
12echo "\n-- Testing array_combine() function with empty array for \$keys argument --\n";
13try {
14    var_dump( array_combine(array(), array(1, 2)) );
15} catch (\ValueError $e) {
16    echo $e->getMessage();
17}
18
19// Testing array_combine by passing empty array to $values
20echo "\n-- Testing array_combine() function with empty array for \$values argument --\n";
21try {
22    var_dump( array_combine(array(1, 2), array()) );
23} catch (\ValueError $e) {
24    echo $e->getMessage();
25}
26
27// Testing array_combine with arrays having unequal number of elements
28echo "\n-- Testing array_combine() function by passing array with unequal number of elements --\n";
29try {
30    var_dump( array_combine(array(1, 2), array(1, 2, 3)) );
31} catch (\ValueError $e) {
32    echo $e->getMessage();
33}
34
35?>
36--EXPECT--
37*** Testing array_combine() : error conditions specific to array_combine() ***
38
39-- Testing array_combine() function with empty arrays --
40array(0) {
41}
42
43-- Testing array_combine() function with empty array for $keys argument --
44array_combine(): Argument #1 ($keys) and argument #2 ($values) must have the same number of elements
45-- Testing array_combine() function with empty array for $values argument --
46array_combine(): Argument #1 ($keys) and argument #2 ($values) must have the same number of elements
47-- Testing array_combine() function by passing array with unequal number of elements --
48array_combine(): Argument #1 ($keys) and argument #2 ($values) must have the same number of elements
49