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 -- 35 36Warning: array_combine(): Both parameters should have at least 1 element in %s on line %d 37bool(false) 38 39-- Testing array_combine() function with empty array for $keys argument -- 40 41Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d 42bool(false) 43 44-- Testing array_combine() function with empty array for $values argument -- 45 46Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d 47bool(false) 48 49-- Testing array_combine() function by passing array with unequal number of elements -- 50 51Warning: array_combine(): Both parameters should have an equal number of elements in %s on line %d 52bool(false) 53Done 54