1--TEST-- 2Test array_chunk() function : error conditions 3--FILE-- 4<?php 5/* Prototype : array array_chunk(array input, int size [, bool preserve_keys]) 6 * Description: Split array into chunks 7 * Source code: ext/standard/array.c 8*/ 9 10echo "*** Testing array_chunk() : error conditions ***\n"; 11 12// Zero arguments 13echo "\n-- Testing array_chunk() function with zero arguments --\n"; 14var_dump( array_chunk() ); 15 16echo "\n-- Testing array_chunk() function with more than expected no. of arguments --\n"; 17$input = array(1, 2); 18$size = 10; 19$preserve_keys = true; 20$extra_arg = 10; 21var_dump( array_chunk($input,$size,$preserve_keys, $extra_arg) ); 22 23echo "\n-- Testing array_chunk() function with less than expected no. of arguments --\n"; 24$input = array(1, 2); 25var_dump( array_chunk($input) ); 26 27echo "Done"; 28?> 29--EXPECTF-- 30*** Testing array_chunk() : error conditions *** 31 32-- Testing array_chunk() function with zero arguments -- 33 34Warning: array_chunk() expects at least 2 parameters, 0 given in %s on line %d 35NULL 36 37-- Testing array_chunk() function with more than expected no. of arguments -- 38 39Warning: array_chunk() expects at most 3 parameters, 4 given in %s on line %d 40NULL 41 42-- Testing array_chunk() function with less than expected no. of arguments -- 43 44Warning: array_chunk() expects at least 2 parameters, 1 given in %s on line %d 45NULL 46Done 47