1--TEST--
2Test ucwords() function : usage variations - heredoc strings
3--FILE--
4<?php
5/*
6 * test ucwords() with different string prepared using heredoc
7*/
8
9echo "*** Testing ucwords() : usage variations ***\n";
10
11// Null here doc string
12$null_string = <<<EOT
13EOT;
14
15// Heredoc string with blank line
16$blank_line = <<<EOT
17
18EOT;
19
20// here doc with multiline string
21$multiline_string = <<<EOT
22testing ucword() with
23multiline string using
24heredoc
25EOT;
26
27// here doc with different whitespaces
28$diff_whitespaces = <<<EOT
29testing\rucword(str)\twith
30multiline   string\t\tusing
31heredoc\nstring.with\vdifferent\fwhite\vspaces
32EOT;
33
34// here doc with numeric values
35$numeric_string = <<<EOT
3612sting 123string 4567
37string\t123string\r12 test\n5test
38EOT;
39
40// heredoc with quote chars & slash
41$quote_char_string = <<<EOT
42it's bright,but i cann't see it.
43"things in double quote"
44'things in single quote'
45this\line is /with\slashs
46EOT;
47
48$heredoc_strings = array(
49  $null_string,
50  $blank_line,
51  $multiline_string,
52  $diff_whitespaces,
53  $numeric_string,
54  $quote_char_string
55);
56
57// loop through $heredoc_strings element and check the working on ucwords()
58$count = 1;
59for($index =0; $index < count($heredoc_strings); $index ++) {
60  echo "-- Iteration $count --\n";
61  var_dump( ucwords($heredoc_strings[$index]) );
62  $count ++;
63}
64
65echo "Done\n";
66?>
67--EXPECT--
68*** Testing ucwords() : usage variations ***
69-- Iteration 1 --
70string(0) ""
71-- Iteration 2 --
72string(0) ""
73-- Iteration 3 --
74string(52) "Testing Ucword() With
75Multiline String Using
76Heredoc"
77-- Iteration 4 --
78string(93) "Testing
78Ucword(str)	With
79Multiline   String		Using
80Heredoc
81String.withDifferentWhiteSpaces"
82-- Iteration 5 --
83string(53) "12sting 123string 4567
84String	123string
8412 Test
855test"
86-- Iteration 6 --
87string(108) "It's Bright,but I Cann't See It.
88"things In Double Quote"
89'things In Single Quote'
90This\line Is /with\slashs"
91Done
92