import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-strings / str_split_variation5.php
blobc3b80eaefec665e53ba73c57abf7eb125847d208
1 <?php
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
8 */
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
18 $split_length = 10;
20 // Null heredoc string
21 $heredoc_null = <<<EOT1
22 EOT1;
24 // heredoc string with single character
25 $heredoc_char = <<<EOT2
27 EOT2;
29 // simple heredoc string
30 $heredoc_str = <<<EOT3
31 This is simple heredoc string
32 EOT3;
34 // heredoc with special characters
35 $heredoc_spchar = <<<EOT4
36 This checks heredoc with $, %, &, chars
37 EOT4;
39 // blank heredoc string
40 $heredoc_blank = <<<EOT5
42 EOT5;
44 // heredoc with different white space characters
45 $heredoc_escchar = <<<EOT6
46 This checks\t str_split()\nEscape\rchars
47 EOT6;
49 // heredoc with multiline
50 $heredoc_multiline= <<<EOT7
51 This is to check str_split
52 function with multiline
53 heredoc
54 EOT7;
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 \
60 which is single slash
61 EOT8;
63 //different heredoc strings for 'str'
64 $heredoc_array = array(
65 $heredoc_null,
66 $heredoc_blank,
67 $heredoc_char,
68 $heredoc_str,
69 $heredoc_multiline,
70 $heredoc_spchar,
71 $heredoc_escchar,
72 $heredoc_quote_slash
76 // loop through each element of the 'heredoc_array' for 'str'
77 $count = 0;
78 foreach($heredoc_array as $str) {
79 echo "-- Iteration ".($count+1). " --\n";
80 var_dump( str_split($str, $split_length) );
81 $count++;
84 echo "Done"