1--TEST-- 2Test array_pad() function : error conditions 3--FILE-- 4<?php 5/* Prototype : array array_pad(array $input, int $pad_size, mixed $pad_value) 6 * Description: Returns a copy of input array padded with pad_value to size pad_size 7 * Source code: ext/standard/array.c 8*/ 9 10echo "*** Testing array_pad() : error conditions ***\n"; 11 12// Zero arguments 13echo "\n-- Testing array_pad() function with Zero arguments --\n"; 14var_dump( array_pad() ); 15 16//Test array_pad with one more than the expected number of arguments 17echo "\n-- Testing array_pad() function with more than expected no. of arguments --\n"; 18$input = array(1, 2); 19$pad_size = 10; 20$pad_value = 1; 21$extra_arg = 10; 22var_dump( array_pad($input, $pad_size, $pad_value, $extra_arg) ); 23 24// Testing array_pad with less than the expected number of arguments 25echo "\n-- Testing array_pad() function with less than expected no. of arguments --\n"; 26$input = array(1, 2); 27$pad_size = 10; 28var_dump( array_pad($input, $pad_size) ); 29var_dump( array_pad($input) ); 30 31echo "Done"; 32?> 33--EXPECTF-- 34*** Testing array_pad() : error conditions *** 35 36-- Testing array_pad() function with Zero arguments -- 37 38Warning: array_pad() expects exactly 3 parameters, 0 given in %s on line %d 39NULL 40 41-- Testing array_pad() function with more than expected no. of arguments -- 42 43Warning: array_pad() expects exactly 3 parameters, 4 given in %s on line %d 44NULL 45 46-- Testing array_pad() function with less than expected no. of arguments -- 47 48Warning: array_pad() expects exactly 3 parameters, 2 given in %s on line %d 49NULL 50 51Warning: array_pad() expects exactly 3 parameters, 1 given in %s on line %d 52NULL 53Done 54