1--TEST--
2Test ucwords() function : usage variations - double quoted string
3--FILE--
4<?php
5/*
6 * test ucwords() with different string prepared using double quote
7*/
8
9echo "*** Testing ucwords() : usage variations ***\n";
10
11// different strings containing regular chars and special chars
12$str_array = array(
13  // multiple spaces
14  "testing    ucwords",
15  "t e s t i n g   u c w o r d s ",
16
17  // brackets in sentence
18  "testing function(ucwords)",
19  "(testing ( function (ucwords) )a )test",
20  "(t)",
21  " ( t )t",
22
23  // using quote chars in sentence
24  "\"testing\",ucwords,\"test\"",
25  "\"t\"\"t\",test, t",
26  "\'t \'t\',test",
27  "Jack's pen",
28  "P't'y 't it's ",
29
30  // using other white spaces
31  "\ttesting\ttesting\tucwords",
32  "\\ttesting\\ttesting\tucwords",
33  "testing\rucwords testing ucwords",
34  "testing\\rucwords testing ucwords",
35  "testing\fucwords \f testing \nucwords",
36  "testing\\fucwords \\f testing \nucwords",
37  "\ntesting\nucwords\n testing \n ucwords",
38  "\\ntesting\\nucwords\\n testing \\n ucwords",
39  "using\vvertical\vtab",
40  "using\\vvertical\\vtab",
41
42  //using special chars in sentence
43  "t@@#$% %test ^test &test *test +test -test",
44  "!test ~test `test` =test= @test@test.com",
45  "/test/r\test\\ucwords\t\y\y\\u\3 \yy\ /uu/",
46
47  //only special chars
48  "!@#$%^&*()_+=-`~"
49);
50
51// loop through the $str_array array to test ucwords on each element
52$iteration = 1;
53for($index = 0; $index < count($str_array); $index++) {
54  echo "-- Iteration $iteration --\n";
55  var_dump( ucwords($str_array[$index]) );
56  $iteration++;
57}
58
59echo "Done\n";
60?>
61--EXPECT--
62*** Testing ucwords() : usage variations ***
63-- Iteration 1 --
64string(18) "Testing    Ucwords"
65-- Iteration 2 --
66string(30) "T E S T I N G   U C W O R D S "
67-- Iteration 3 --
68string(25) "Testing Function(ucwords)"
69-- Iteration 4 --
70string(38) "(testing ( Function (ucwords) )a )test"
71-- Iteration 5 --
72string(3) "(t)"
73-- Iteration 6 --
74string(7) " ( T )t"
75-- Iteration 7 --
76string(24) ""testing",ucwords,"test""
77-- Iteration 8 --
78string(14) ""t""t",test, T"
79-- Iteration 9 --
80string(14) "\'t \'t\',test"
81-- Iteration 10 --
82string(10) "Jack's Pen"
83-- Iteration 11 --
84string(14) "P't'y 't It's "
85-- Iteration 12 --
86string(24) "	Testing	Testing	Ucwords"
87-- Iteration 13 --
88string(26) "\ttesting\ttesting	Ucwords"
89-- Iteration 14 --
90string(31) "Testing
90Ucwords Testing Ucwords"
91-- Iteration 15 --
92string(32) "Testing\rucwords Testing Ucwords"
93-- Iteration 16 --
94string(34) "TestingUcwords  Testing
95Ucwords"
96-- Iteration 17 --
97string(36) "Testing\fucwords \f Testing
98Ucwords"
99-- Iteration 18 --
100string(35) "
101Testing
102Ucwords
103 Testing
104 Ucwords"
105-- Iteration 19 --
106string(39) "\ntesting\nucwords\n Testing \n Ucwords"
107-- Iteration 20 --
108string(18) "UsingVerticalTab"
109-- Iteration 21 --
110string(20) "Using\vvertical\vtab"
111-- Iteration 22 --
112string(42) "T@@#$% %test ^test &test *test +test -test"
113-- Iteration 23 --
114string(40) "!test ~test `test` =test= @test@test.com"
115-- Iteration 24 --
116string(37) "/test/r	Est\ucwords	\y\y\u \yy\ /uu/"
117-- Iteration 25 --
118string(16) "!@#$%^&*()_+=-`~"
119Done
120