2 /* Prototype : array str_split(string $str [, int $split_length] )
3 * Description: Convert a string to an array. If split_length is
4 specified, break the string down into chunks each
5 split_length characters long.
6 * Source code: ext/standard/string.c
7 * Alias to functions: none
11 * Passing different heredoc strings as 'str' argument to the str_split()
12 * with 'split_length' 10
15 echo "*** Testing str_split() : heredoc strings as 'str' argument ***\n";
17 // Initializing required variables
20 // Null heredoc string
21 $heredoc_null = <<<EOT1
24 // heredoc string with single character
25 $heredoc_char = <<<EOT2
29 // simple heredoc string
30 $heredoc_str = <<<EOT3
31 This is simple heredoc string
34 // heredoc with special characters
35 $heredoc_spchar = <<<EOT4
36 This checks heredoc with $, %, &, chars
39 // blank heredoc string
40 $heredoc_blank = <<<EOT5
44 // heredoc with different white space characters
45 $heredoc_escchar = <<<EOT6
46 This checks\t str_split()\nEscape\rchars
49 // heredoc with multiline
50 $heredoc_multiline= <<<EOT7
51 This is to check str_split
52 function with multiline
56 // heredoc with quotes and slashes
57 $heredoc_quote_slash = <<<EOT8
58 "To check " in heredoc"
59 I'm sure it'll work also with \
63 //different heredoc strings for 'str'
64 $heredoc_array = array(
76 // loop through each element of the 'heredoc_array' for 'str'
78 foreach($heredoc_array as $str) {
79 echo "-- Iteration ".($count+1). " --\n";
80 var_dump( str_split($str, $split_length) );