summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/chunk_split_variation13.phpt
blob: 38b8f9568aa1390609cd16198df4cde7fbaf3c0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--TEST--
Test chunk_split() function : usage variations - default 'chunklen' with long string as 'str'argument
--FILE--
<?php
/* Prototype  : string chunk_split(string $str [, int $chunklen [, string $ending]])
 * Description: Returns split line
 * Source code: ext/standard/string.c
 * Alias to functions: 
*/

/*
* passing long string as 'str' and testing default value of chunklen which is 76
*/

echo "*** Testing chunk_split() : default 'chunklen' with long string 'str' ***\n";

//Initializing variables
$values = array (
  "123456789012345678901234567890123456789012345678901234567890123456789012345678901",
  "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901"
);

//loop through each element of values for 'str' and default value of 'chunklen'
for($count = 0; $count < count($values); $count++) {
  echo "-- Iteration $count --\n";
  var_dump( chunk_split($values[$count]) );
}

echo "Done"
?>
--EXPECT--
*** Testing chunk_split() : default 'chunklen' with long string 'str' ***
-- Iteration 0 --
string(85) "1234567890123456789012345678901234567890123456789012345678901234567890123456
78901
"
-- Iteration 1 --
string(217) "1234567890123456789012345678901234567890123456789012345678901234567890123456
7890123456789012345678901234567890123456789012345678901234567890123456789012
34567890123456789012345678901234567890123456789012345678901
"
Done