Return to array_combine_error1.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / array |
1.1 misho 1: --TEST-- 2: Test 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: 11: echo "*** Testing array_combine() : error conditions ***\n"; 12: 13: // Zero arguments 14: echo "\n-- Testing array_combine() function with Zero arguments --\n"; 15: var_dump( array_combine() ); 16: 17: //Test array_combine with one more than the expected number of arguments 18: echo "\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; 22: var_dump( array_combine($keys,$values, $extra_arg) ); 23: 24: // Testing array_combine with one less than the expected number of arguments 25: echo "\n-- Testing array_combine() function with less than expected no. of arguments --\n"; 26: $keys = array(1, 2); 27: var_dump( array_combine($keys) ); 28: 29: echo "Done"; 30: ?> 31: --EXPECTF-- 32: *** Testing array_combine() : error conditions *** 33: 34: -- Testing array_combine() function with Zero arguments -- 35: 36: Warning: array_combine() expects exactly 2 parameters, 0 given in %s on line %d 37: NULL 38: 39: -- Testing array_combine() function with more than expected no. of arguments -- 40: 41: Warning: array_combine() expects exactly 2 parameters, 3 given in %s on line %d 42: NULL 43: 44: -- Testing array_combine() function with less than expected no. of arguments -- 45: 46: Warning: array_combine() expects exactly 2 parameters, 1 given in %s on line %d 47: NULL 48: Done