Annotation of embedaddon/php/ext/standard/tests/strings/ucwords_basic.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test ucwords() function : basic functionality
3: --FILE--
4: <?php
5: /* Prototype : string ucwords ( string $str )
6: * Description: Uppercase the first character of each word in a string
7: * Source code: ext/standard/string.c
8: */
9:
10: echo "*** Testing ucwords() : basic functionality ***\n";
11:
12: // lines with different whitespace charecter
13: $str_array = array(
14: "testing ucwords",
15: 'testing ucwords',
16: 'testing\tucwords',
17: "testing\tucwords",
18: "testing\nucwords",
19: 'testing\nucwords',
20: "testing\vucwords",
21: 'testing\vucwords',
22: "testing",
23: 'testing',
24: ' testing',
25: " testing",
26: "testing ucwords",
27: 'testing ucwords',
28: 'testing\rucwords',
29: "testing\rucwords",
30: 'testing\fucwords',
31: "testing\fucwords"
32: );
33:
34: // loop through the $strings array to test ucwords on each element
35: $iteration = 1;
36: for($index = 0; $index < count($str_array); $index++) {
37: echo "-- Iteration $iteration --\n";
38: var_dump( ucwords($str_array[$index]) );
39: $iteration++;
40: }
41:
42: echo "Done\n";
43: ?>
44: --EXPECTF--
45: *** Testing ucwords() : basic functionality ***
46: -- Iteration 1 --
47: string(15) "Testing Ucwords"
48: -- Iteration 2 --
49: string(15) "Testing Ucwords"
50: -- Iteration 3 --
51: string(16) "Testing\tucwords"
52: -- Iteration 4 --
53: string(15) "Testing Ucwords"
54: -- Iteration 5 --
55: string(15) "Testing
56: Ucwords"
57: -- Iteration 6 --
58: string(16) "Testing\nucwords"
59: -- Iteration 7 --
60: string(15) "TestingUcwords"
61: -- Iteration 8 --
62: string(16) "Testing\vucwords"
63: -- Iteration 9 --
64: string(7) "Testing"
65: -- Iteration 10 --
66: string(7) "Testing"
67: -- Iteration 11 --
68: string(8) " Testing"
69: -- Iteration 12 --
70: string(8) " Testing"
71: -- Iteration 13 --
72: string(16) "Testing Ucwords"
73: -- Iteration 14 --
74: string(16) "Testing Ucwords"
75: -- Iteration 15 --
76: string(16) "Testing\rucwords"
77: -- Iteration 16 --
78: string(15) "Testing
Ucwords"
79: -- Iteration 17 --
80: string(16) "Testing\fucwords"
81: -- Iteration 18 --
82: string(15) "TestingUcwords"
83: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>