1--TEST-- 2Test str_split() function : basic functionality 3--FILE-- 4<?php 5echo "*** Testing str_split() : basic functionality ***\n"; 6 7// Initialise all required variables 8$str = 'This is basic testcase'; 9$split_length = 5; 10 11// Calling str_split() with all possible arguments 12echo "-- With all possible arguments --\n"; 13var_dump( str_split($str,$split_length) ); 14 15// Calling str_split() with default arguments 16echo "-- With split_length as default argument --\n"; 17var_dump( str_split($str) ); 18 19echo "Done" 20?> 21--EXPECT-- 22*** Testing str_split() : basic functionality *** 23-- With all possible arguments -- 24array(5) { 25 [0]=> 26 string(5) "This " 27 [1]=> 28 string(5) "is ba" 29 [2]=> 30 string(5) "sic t" 31 [3]=> 32 string(5) "estca" 33 [4]=> 34 string(2) "se" 35} 36-- With split_length as default argument -- 37array(22) { 38 [0]=> 39 string(1) "T" 40 [1]=> 41 string(1) "h" 42 [2]=> 43 string(1) "i" 44 [3]=> 45 string(1) "s" 46 [4]=> 47 string(1) " " 48 [5]=> 49 string(1) "i" 50 [6]=> 51 string(1) "s" 52 [7]=> 53 string(1) " " 54 [8]=> 55 string(1) "b" 56 [9]=> 57 string(1) "a" 58 [10]=> 59 string(1) "s" 60 [11]=> 61 string(1) "i" 62 [12]=> 63 string(1) "c" 64 [13]=> 65 string(1) " " 66 [14]=> 67 string(1) "t" 68 [15]=> 69 string(1) "e" 70 [16]=> 71 string(1) "s" 72 [17]=> 73 string(1) "t" 74 [18]=> 75 string(1) "c" 76 [19]=> 77 string(1) "a" 78 [20]=> 79 string(1) "s" 80 [21]=> 81 string(1) "e" 82} 83Done 84