Annotation of embedaddon/php/ext/standard/tests/strings/strrev_variation1.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test strrev() function : usage variations - double quoted strings
3: --FILE--
4: <?php
5: /* Prototype : string strrev(string $str);
6: * Description: Reverse a string
7: * Source code: ext/standard/string.c
8: */
9:
10: /* Testing strrev() function with various double quoted strings for 'str' */
11:
12: echo "*** Testing strrev() : with various double quoted strings ***\n";
13: $str = "Hiiii";
14:
15: $strings = array(
16: //strings containing escape chars
17: "hello\\world",
18: "hello\$world",
19: "\ttesting\ttesting\tstrrev",
20: "testing\rstrrev testing strrev",
21: "testing\fstrrev \f testing \nstrrev",
22: "\ntesting\nstrrev\n testing \n strrev",
23: "using\vvertical\vtab",
24:
25: //polyndrome strings
26: "HelloolleH",
27: "ababababababa",
28:
29: //numeric + strings
30: "Hello123",
31: "123Hello",
32: "123.34Hello",
33: "Hello1.234",
34: "123Hello1.234",
35:
36: //concatenated strings
37: "Hello".chr(0)."World",
38: "Hello"."world",
39: "Hello".$str,
40:
41: //strings containing white spaces
42: " h",
43: "h ",
44: " h ",
45: "h e l l o ",
46:
47: //strings containing quotes
48: "\hello\'world",
49: "hello\"world",
50:
51: //special chars in strings
52: "t@@#$% %test ^test &test *test +test -test",
53: "!test ~test `test` =test= @test@test.com",
54: "/test/r\test\strrev\t\u /uu/",
55:
56: //only special chars
57: "!@#$%^&*()_+=-`~"
58: );
59:
60: $count = 1;
61: for( $index = 0; $index < count($strings); $index++ ) {
62: echo "\n-- Iteration $count --\n";
63: var_dump( strrev($strings[$index]) );
64: $count ++;
65: }
66:
67: echo "*** Done ***";
68: ?>
69: --EXPECTF--
70: *** Testing strrev() : with various double quoted strings ***
71:
72: -- Iteration 1 --
73: string(11) "dlrow\olleh"
74:
75: -- Iteration 2 --
76: string(11) "dlrow$olleh"
77:
78: -- Iteration 3 --
79: string(23) "verrts gnitset gnitset "
80:
81: -- Iteration 4 --
82: string(29) "verrts gnitset verrts
gnitset"
83:
84: -- Iteration 5 --
85: string(32) "verrts
86: gnitset verrtsgnitset"
87:
88: -- Iteration 6 --
89: string(33) "verrts
90: gnitset
91: verrts
92: gnitset
93: "
94:
95: -- Iteration 7 --
96: string(18) "batlacitrevgnisu"
97:
98: -- Iteration 8 --
99: string(10) "HelloolleH"
100:
101: -- Iteration 9 --
102: string(13) "ababababababa"
103:
104: -- Iteration 10 --
105: string(8) "321olleH"
106:
107: -- Iteration 11 --
108: string(8) "olleH321"
109:
110: -- Iteration 12 --
111: string(11) "olleH43.321"
112:
113: -- Iteration 13 --
114: string(10) "432.1olleH"
115:
116: -- Iteration 14 --
117: string(13) "432.1olleH321"
118:
119: -- Iteration 15 --
120: string(11) "dlroW olleH"
121:
122: -- Iteration 16 --
123: string(10) "dlrowolleH"
124:
125: -- Iteration 17 --
126: string(10) "iiiiHolleH"
127:
128: -- Iteration 18 --
129: string(15) "h "
130:
131: -- Iteration 19 --
132: string(15) " h"
133:
134: -- Iteration 20 --
135: string(15) " h "
136:
137: -- Iteration 21 --
138: string(15) " o l l e h"
139:
140: -- Iteration 22 --
141: string(13) "dlrow'\olleh\"
142:
143: -- Iteration 23 --
144: string(11) "dlrow"olleh"
145:
146: -- Iteration 24 --
147: string(42) "tset- tset+ tset* tset& tset^ tset% %$#@@t"
148:
149: -- Iteration 25 --
150: string(40) "moc.tset@tset@ =tset= `tset` tset~ tset!"
151:
152: -- Iteration 26 --
153: string(26) "/uu/ u\ verrts\tse r/tset/"
154:
155: -- Iteration 27 --
156: string(16) "~`-=+_)(*&^%$#@!"
157: *** Done ***
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>