1--TEST--
2Test 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
12echo "*** 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;
61for( $index = 0; $index < count($strings); $index++ ) {
62  echo "\n-- Iteration $count --\n";
63  var_dump( strrev($strings[$index]) );
64  $count ++;
65}
66
67echo "*** Done ***";
68?>
69--EXPECTF--
70*** Testing strrev() : with various double quoted strings ***
71
72-- Iteration 1 --
73string(11) "dlrow\olleh"
74
75-- Iteration 2 --
76string(11) "dlrow$olleh"
77
78-- Iteration 3 --
79string(23) "verrts	gnitset	gnitset	"
80
81-- Iteration 4 --
82string(29) "verrts gnitset verrts
82gnitset"
83
84-- Iteration 5 --
85string(32) "verrts
86 gnitset  verrtsgnitset"
87
88-- Iteration 6 --
89string(33) "verrts
90 gnitset
91verrts
92gnitset
93"
94
95-- Iteration 7 --
96string(18) "batlacitrevgnisu"
97
98-- Iteration 8 --
99string(10) "HelloolleH"
100
101-- Iteration 9 --
102string(13) "ababababababa"
103
104-- Iteration 10 --
105string(8) "321olleH"
106
107-- Iteration 11 --
108string(8) "olleH321"
109
110-- Iteration 12 --
111string(11) "olleH43.321"
112
113-- Iteration 13 --
114string(10) "432.1olleH"
115
116-- Iteration 14 --
117string(13) "432.1olleH321"
118
119-- Iteration 15 --
120string(11) "dlroW�olleH"
121
122-- Iteration 16 --
123string(10) "dlrowolleH"
124
125-- Iteration 17 --
126string(10) "iiiiHolleH"
127
128-- Iteration 18 --
129string(15) "h              "
130
131-- Iteration 19 --
132string(15) "              h"
133
134-- Iteration 20 --
135string(15) "        h      "
136
137-- Iteration 21 --
138string(15) "  o  l  l  e  h"
139
140-- Iteration 22 --
141string(13) "dlrow'\olleh\"
142
143-- Iteration 23 --
144string(11) "dlrow"olleh"
145
146-- Iteration 24 --
147string(42) "tset- tset+ tset* tset& tset^ tset% %$#@@t"
148
149-- Iteration 25 --
150string(40) "moc.tset@tset@ =tset= `tset` tset~ tset!"
151
152-- Iteration 26 --
153string(26) "/uu/ u\	verrts\tse	r/tset/"
154
155-- Iteration 27 --
156string(16) "~`-=+_)(*&^%$#@!"
157*** Done ***
158