Return to array_diff_error.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / array |
1.1 misho 1: --TEST-- 2: Test array_diff() function : error conditions - too few arguments passed to function 3: --FILE-- 4: <?php 5: /* Prototype : array array_diff(array $arr1, array $arr2 [, array ...]) 6: * Description: Returns the entries of $arr1 that have values which are 7: * not present in any of the others arguments. 8: * Source code: ext/standard/array.c 9: */ 10: 11: /* 12: * Test array_diff with less than the expected number of arguments 13: */ 14: 15: echo "*** Testing array_diff() : error conditions ***\n"; 16: // Zero arguments 17: echo "\n-- Testing array_diff() function with zero arguments --\n"; 18: var_dump( array_diff() ); 19: 20: 21: // Testing array_diff with one less than the expected number of arguments 22: echo "\n-- Testing array_diff() function with less than expected no. of arguments --\n"; 23: $arr1 = array(1, 2); 24: var_dump( array_diff($arr1) ); 25: 26: echo "Done"; 27: ?> 28: --EXPECTF-- 29: *** Testing array_diff() : error conditions *** 30: 31: -- Testing array_diff() function with zero arguments -- 32: 33: Warning: array_diff(): at least 2 parameters are required, 0 given in %s on line %d 34: NULL 35: 36: -- Testing array_diff() function with less than expected no. of arguments -- 37: 38: Warning: array_diff(): at least 2 parameters are required, 1 given in %s on line %d 39: NULL 40: Done