1--TEST-- 2Test array_slice() function : error conditions - Pass incorrect number of args 3--FILE-- 4<?php 5/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]]) 6 * Description: Returns elements specified by offset and length 7 * Source code: ext/standard/array.c 8 */ 9 10/* 11 * Pass an incorrect number of arguments to array_slice() to test behaviour 12 */ 13 14echo "*** Testing array_slice() : error conditions ***\n"; 15 16//Test array_slice with one more than the expected number of arguments 17echo "\n-- Testing array_slice() function with more than expected no. of arguments --\n"; 18$input = array(1, 2); 19$offset = 10; 20$length = 10; 21$preserve_keys = true; 22$extra_arg = 10; 23var_dump( array_slice($input, $offset, $length, $preserve_keys, $extra_arg) ); 24 25// Testing array_slice with one less than the expected number of arguments 26echo "\n-- Testing array_slice() function with less than expected no. of arguments --\n"; 27var_dump( array_slice($input) ); 28 29echo "Done"; 30?> 31--EXPECTF-- 32*** Testing array_slice() : error conditions *** 33 34-- Testing array_slice() function with more than expected no. of arguments -- 35 36Warning: array_slice() expects at most 4 parameters, 5 given in %s on line %d 37NULL 38 39-- Testing array_slice() function with less than expected no. of arguments -- 40 41Warning: array_slice() expects at least 2 parameters, 1 given in %s on line %d 42NULL 43Done 44