1--TEST--
2Test strrev() function : usage variations - single 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 single quoted strings for 'str' */
11
12echo "*** Testing strrev() : with various single 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 string
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 single quoted strings ***
71
72-- Iteration 1 --
73string(11) "dlrow\olleh"
74
75-- Iteration 2 --
76string(12) "dlrow$\olleh"
77
78-- Iteration 3 --
79string(26) "verrtst\gnitsett\gnitsett\"
80
81-- Iteration 4 --
82string(30) "verrts gnitset verrtsr\gnitset"
83
84-- Iteration 5 --
85string(35) "verrtsn\ gnitset f\ verrtsf\gnitset"
86
87-- Iteration 6 --
88string(37) "verrts n\ gnitset n\verrtsn\gnitsetn\"
89
90-- Iteration 7 --
91string(20) "batv\lacitrevv\gnisu"
92
93-- Iteration 8 --
94string(10) "HelloolleH"
95
96-- Iteration 9 --
97string(13) "ababababababa"
98
99-- Iteration 10 --
100string(8) "321olleH"
101
102-- Iteration 11 --
103string(8) "olleH321"
104
105-- Iteration 12 --
106string(11) "olleH43.321"
107
108-- Iteration 13 --
109string(10) "432.1olleH"
110
111-- Iteration 14 --
112string(13) "432.1olleH321"
113
114-- Iteration 15 --
115string(11) "dlroW�olleH"
116
117-- Iteration 16 --
118string(10) "dlrowolleH"
119
120-- Iteration 17 --
121string(10) "iiiiHolleH"
122
123-- Iteration 18 --
124string(15) "h              "
125
126-- Iteration 19 --
127string(15) "              h"
128
129-- Iteration 20 --
130string(15) "        h      "
131
132-- Iteration 21 --
133string(15) "  o  l  l  e  h"
134
135-- Iteration 22 --
136string(12) "dlrow'olleh\"
137
138-- Iteration 23 --
139string(12) "dlrow"\olleh"
140
141-- Iteration 24 --
142string(42) "tset- tset+ tset* tset& tset^ tset% %$#@@t"
143
144-- Iteration 25 --
145string(40) "moc.tset@tset@ =tset= `tset` tset~ tset!"
146
147-- Iteration 26 --
148string(28) "/uu/ u\t\verrts\tset\r/tset/"
149
150-- Iteration 27 --
151string(16) "~`-=+_)(*&^%$#@!"
152*** Done ***
153