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