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 "-- Empty string must always return empty array --\n";
20var_dump( str_split('') );
21var_dump( str_split('', 1) );
22var_dump( str_split('', 100) );
23
24?>
25--EXPECT--
26*** Testing str_split() : basic functionality ***
27-- With all possible arguments --
28array(5) {
29  [0]=>
30  string(5) "This "
31  [1]=>
32  string(5) "is ba"
33  [2]=>
34  string(5) "sic t"
35  [3]=>
36  string(5) "estca"
37  [4]=>
38  string(2) "se"
39}
40-- With split_length as default argument --
41array(22) {
42  [0]=>
43  string(1) "T"
44  [1]=>
45  string(1) "h"
46  [2]=>
47  string(1) "i"
48  [3]=>
49  string(1) "s"
50  [4]=>
51  string(1) " "
52  [5]=>
53  string(1) "i"
54  [6]=>
55  string(1) "s"
56  [7]=>
57  string(1) " "
58  [8]=>
59  string(1) "b"
60  [9]=>
61  string(1) "a"
62  [10]=>
63  string(1) "s"
64  [11]=>
65  string(1) "i"
66  [12]=>
67  string(1) "c"
68  [13]=>
69  string(1) " "
70  [14]=>
71  string(1) "t"
72  [15]=>
73  string(1) "e"
74  [16]=>
75  string(1) "s"
76  [17]=>
77  string(1) "t"
78  [18]=>
79  string(1) "c"
80  [19]=>
81  string(1) "a"
82  [20]=>
83  string(1) "s"
84  [21]=>
85  string(1) "e"
86}
87-- Empty string must always return empty array --
88array(0) {
89}
90array(0) {
91}
92array(0) {
93}
94