blob: cce8e4d64c90bfbd38cc1b953de59d9aab9d016a (
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
43
44
45
46
47
48
49
50
51
52
53
|
--TEST--
Test chunk_split() function : basic functionality
--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:
*/
/*
* Testing chunk_split() for basic functionality by passing all possible
* arguments as well as with default arguments chunklen and ending
*/
echo "*** Testing chunk_split() : basic functionality ***\n";
// Initialise all required variables
$str = 'Testing';
$chunklen = 2;
$ending = '##';
// Calling chunk_split() with all possible arguments
echo "-- Testing chunk_split() with all possible arguments --\n";
var_dump( chunk_split($str, $chunklen, $ending) );
// Calling chunk_split() with default ending string
echo "-- Testing chunk_split() with default ending string --\n";
var_dump( chunk_split($str, $chunklen) );
//Calling chunk_split() with default chunklen and ending string
echo "-- Testing chunk_split() with default chunklen and ending string --\n";
var_dump( chunk_split($str) );
echo "Done"
?>
--EXPECT--
*** Testing chunk_split() : basic functionality ***
-- Testing chunk_split() with all possible arguments --
string(15) "Te##st##in##g##"
-- Testing chunk_split() with default ending string --
string(15) "Te
st
in
g
"
-- Testing chunk_split() with default chunklen and ending string --
string(9) "Testing
"
Done
|