1--TEST--
2Test chunk_split() function : basic functionality
3--FILE--
4<?php
5/* Prototype  : string chunk_split(string $str [, int $chunklen [, string $ending]])
6 * Description: Returns split line
7 * Source code: ext/standard/string.c
8 * Alias to functions:
9*/
10
11/*
12* Testing chunk_split() for basic functionality by passing all possible
13* arguments as well as with default arguments chunklen and ending
14*/
15
16echo "*** Testing chunk_split() : basic functionality ***\n";
17
18
19// Initialise all required variables
20$str = 'Testing';
21$chunklen = 2;
22$ending = '##';
23
24// Calling chunk_split() with all possible arguments
25echo "-- Testing chunk_split() with all possible arguments --\n";
26var_dump( chunk_split($str, $chunklen, $ending) );
27
28
29// Calling chunk_split() with default ending string
30echo "-- Testing chunk_split() with default ending string --\n";
31var_dump( chunk_split($str, $chunklen) );
32
33
34//Calling chunk_split() with default chunklen and ending string
35echo "-- Testing chunk_split() with default chunklen and ending string --\n";
36var_dump( chunk_split($str) );
37
38echo "Done"
39?>
40--EXPECTF--
41*** Testing chunk_split() : basic functionality ***
42-- Testing chunk_split() with all possible arguments --
43string(15) "Te##st##in##g##"
44-- Testing chunk_split() with default ending string --
45string(15) "Te
46st
47in
48g
49"
50-- Testing chunk_split() with default chunklen and ending string --
51string(9) "Testing
52"
53Done
54