1--TEST--
2Test ucwords() function : basic functionality
3--FILE--
4<?php
5echo "*** Testing ucwords() : basic functionality ***\n";
6
7// lines with different whitespace character
8$str_array = array(
9 "testing ucwords",
10 'testing ucwords',
11 'testing\tucwords',
12 "testing\tucwords",
13 "testing\nucwords",
14 'testing\nucwords',
15 "testing\vucwords",
16 'testing\vucwords',
17 "testing",
18 'testing',
19 ' testing',
20 " testing",
21 "testing  ucwords",
22 'testing  ucwords',
23 'testing\rucwords',
24 "testing\rucwords",
25 'testing\fucwords',
26 "testing\fucwords"
27);
28
29// loop through the $strings array to test ucwords on each element
30$iteration = 1;
31for($index = 0; $index < count($str_array); $index++) {
32  echo "-- Iteration $iteration --\n";
33  var_dump( ucwords($str_array[$index]) );
34  $iteration++;
35}
36
37echo "Done\n";
38?>
39--EXPECT--
40*** Testing ucwords() : basic functionality ***
41-- Iteration 1 --
42string(15) "Testing Ucwords"
43-- Iteration 2 --
44string(15) "Testing Ucwords"
45-- Iteration 3 --
46string(16) "Testing\tucwords"
47-- Iteration 4 --
48string(15) "Testing	Ucwords"
49-- Iteration 5 --
50string(15) "Testing
51Ucwords"
52-- Iteration 6 --
53string(16) "Testing\nucwords"
54-- Iteration 7 --
55string(15) "TestingUcwords"
56-- Iteration 8 --
57string(16) "Testing\vucwords"
58-- Iteration 9 --
59string(7) "Testing"
60-- Iteration 10 --
61string(7) "Testing"
62-- Iteration 11 --
63string(8) " Testing"
64-- Iteration 12 --
65string(8) " Testing"
66-- Iteration 13 --
67string(16) "Testing  Ucwords"
68-- Iteration 14 --
69string(16) "Testing  Ucwords"
70-- Iteration 15 --
71string(16) "Testing\rucwords"
72-- Iteration 16 --
73string(15) "Testing
73Ucwords"
74-- Iteration 17 --
75string(16) "Testing\fucwords"
76-- Iteration 18 --
77string(15) "TestingUcwords"
78Done
79