1--TEST-- 2Test str_split() function : error conditions 3--FILE-- 4<?php 5/* Prototype : array str_split(string $str [, int $split_length]) 6 * Description: Convert a string to an array. If split_length is 7 specified, break the string down into chunks each 8 split_length characters long. 9 * Source code: ext/standard/string.c 10 * Alias to functions: none 11*/ 12 13echo "*** Testing str_split() : error conditions ***\n"; 14 15// Zero arguments 16echo "-- Testing str_split() function with Zero arguments --\n"; 17var_dump( str_split() ); 18 19//Test str_split with one more than the expected number of arguments 20echo "-- Testing str_split() function with more than expected no. of arguments --\n"; 21$str = 'This is error testcase'; 22$split_length = 4; 23$extra_arg = 10; 24var_dump( str_split( $str, $split_length, $extra_arg) ); 25 26echo "Done" 27?> 28--EXPECTF-- 29*** Testing str_split() : error conditions *** 30-- Testing str_split() function with Zero arguments -- 31 32Warning: str_split() expects at least 1 parameter, 0 given in %s on line %d 33NULL 34-- Testing str_split() function with more than expected no. of arguments -- 35 36Warning: str_split() expects at most 2 parameters, 3 given in %s on line %d 37NULL 38Done 39