import zend standard tests
[hiphop-php.git] / hphp / test / zend / good / ext-standard-strings / str_split_variation4.php
blobb6288e36f7d7c2f10b71c8d1f3f60e7bb9b0dc7b
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 single quoted strings as 'str' argument to str_split()
12 * split_length is set to 5
15 echo "*** Testing str_split() : single quoted strings for 'str' ***\n";
17 //Initialize variables
18 $split_length = 5;
20 // different values for 'str'
21 $values = array(
22 '', //empty
23 ' ', //space
24 '1234', //with only numbers
25 'simple string', //regular string
26 'It\'s string with quote', //string containing single quote
27 'string\tcontains\rwhite space\nchars',
28 'containing @ # $ % ^ & chars',
29 'with 1234 numbers',
30 'with \0 and ".chr(0)."null chars', //for binary safe
31 'with multiple space char',
32 'Testing invalid \k and \m escape char',
33 'to check with \\n and \\t' //ignoring \n and \t results
36 //loop through each element of $values for 'str' argument
37 for($count = 0; $count < count($values); $count++) {
38 echo "-- Iteration ".($count+1)." --\n";
39 var_dump( str_split($values[$count], $split_length) );
41 echo "Done"