1--TEST-- 2Test array_combine() function : error conditions 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 ***\n"; 12 13// Zero arguments 14echo "\n-- Testing array_combine() function with Zero arguments --\n"; 15var_dump( array_combine() ); 16 17//Test array_combine with one more than the expected number of arguments 18echo "\n-- Testing array_combine() function with more than expected no. of arguments --\n"; 19$keys = array(1, 2); 20$values = array(1, 2); 21$extra_arg = 10; 22var_dump( array_combine($keys,$values, $extra_arg) ); 23 24// Testing array_combine with one less than the expected number of arguments 25echo "\n-- Testing array_combine() function with less than expected no. of arguments --\n"; 26$keys = array(1, 2); 27var_dump( array_combine($keys) ); 28 29echo "Done"; 30?> 31--EXPECTF-- 32*** Testing array_combine() : error conditions *** 33 34-- Testing array_combine() function with Zero arguments -- 35 36Warning: array_combine() expects exactly 2 parameters, 0 given in %s on line %d 37NULL 38 39-- Testing array_combine() function with more than expected no. of arguments -- 40 41Warning: array_combine() expects exactly 2 parameters, 3 given in %s on line %d 42NULL 43 44-- Testing array_combine() function with less than expected no. of arguments -- 45 46Warning: array_combine() expects exactly 2 parameters, 1 given in %s on line %d 47NULL 48Done 49