1--TEST--
2Test strripos() function : usage variations - single quoted strings for 'haystack' & 'needle' arguments
3--FILE--
4<?php
5/* Test strripos() function by passing single quoted strings to 'haystack' & 'needle' arguments */
6
7echo "*** Testing strripos() function: with single quoted strings ***\n";
8$haystack = 'Hello,\t\n\0\n  $&!#%()*<=>?@hello123456he \x234 \101 ';
9$needles = array(
10          //regular strings
11/*1*/	  'l',
12          'L',
13          'HELLO',
14          'hEllo',
15
16          //escape characters
17/*5*/	  '\t',
18          '\T',
19          '     ',
20          '\n',
21          '\N',
22          '
23        ',  //new line
24
25          //nulls
26/*11*/	  '\0',
27
28          //boolean false
29/*14*/	  FALSE,
30          false,
31
32          //empty string
33/*16*/	  '',
34
35          //special chars
36/*17*/	  ' ',
37          '$',
38          ' $',
39          '&',
40          '!#',
41          '()',
42          '<=>',
43          '>',
44          '=>',
45          '?',
46          '@',
47          '@hEllo',
48
49/*29*/	  '12345', 	//decimal numeric string
50          '\x23',	//hexadecimal numeric string
51          '#',  	//respective ASCII char of \x23
52          '\101',  	//octal numeric string
53          'A', 		// respective ASCII char for \101
54          '456HEE', //numerics + chars
55          42, 		//needle as int(ASCII value of '*')
56          $haystack  //haystack as needle
57);
58
59/* loop through to get the position of the needle in haystack string */
60$count = 1;
61foreach ($needles as $needle) {
62  echo "-- Iteration $count --\n";
63  var_dump( strripos($haystack, $needle) );
64  var_dump( strripos($haystack, $needle, 1) );
65  var_dump( strripos($haystack, $needle, 20) );
66  var_dump( strripos($haystack, $needle, -1) );
67  $count++;
68}
69?>
70--EXPECT--
71*** Testing strripos() function: with single quoted strings ***
72-- Iteration 1 --
73int(32)
74int(32)
75int(32)
76int(32)
77-- Iteration 2 --
78int(32)
79int(32)
80int(32)
81int(32)
82-- Iteration 3 --
83int(29)
84int(29)
85int(29)
86int(29)
87-- Iteration 4 --
88int(29)
89int(29)
90int(29)
91int(29)
92-- Iteration 5 --
93int(6)
94int(6)
95bool(false)
96int(6)
97-- Iteration 6 --
98int(6)
99int(6)
100bool(false)
101int(6)
102-- Iteration 7 --
103bool(false)
104bool(false)
105bool(false)
106bool(false)
107-- Iteration 8 --
108int(12)
109int(12)
110bool(false)
111int(12)
112-- Iteration 9 --
113int(12)
114int(12)
115bool(false)
116int(12)
117-- Iteration 10 --
118bool(false)
119bool(false)
120bool(false)
121bool(false)
122-- Iteration 11 --
123int(10)
124int(10)
125bool(false)
126int(10)
127-- Iteration 12 --
128int(54)
129int(54)
130int(54)
131int(53)
132-- Iteration 13 --
133int(54)
134int(54)
135int(54)
136int(53)
137-- Iteration 14 --
138int(54)
139int(54)
140int(54)
141int(53)
142-- Iteration 15 --
143int(53)
144int(53)
145int(53)
146int(53)
147-- Iteration 16 --
148int(16)
149int(16)
150bool(false)
151int(16)
152-- Iteration 17 --
153int(15)
154int(15)
155bool(false)
156int(15)
157-- Iteration 18 --
158int(17)
159int(17)
160bool(false)
161int(17)
162-- Iteration 19 --
163int(18)
164int(18)
165bool(false)
166int(18)
167-- Iteration 20 --
168int(21)
169int(21)
170int(21)
171int(21)
172-- Iteration 21 --
173int(24)
174int(24)
175int(24)
176int(24)
177-- Iteration 22 --
178int(26)
179int(26)
180int(26)
181int(26)
182-- Iteration 23 --
183int(25)
184int(25)
185int(25)
186int(25)
187-- Iteration 24 --
188int(27)
189int(27)
190int(27)
191int(27)
192-- Iteration 25 --
193int(28)
194int(28)
195int(28)
196int(28)
197-- Iteration 26 --
198int(28)
199int(28)
200int(28)
201int(28)
202-- Iteration 27 --
203int(34)
204int(34)
205int(34)
206int(34)
207-- Iteration 28 --
208int(43)
209int(43)
210int(43)
211int(43)
212-- Iteration 29 --
213int(19)
214int(19)
215bool(false)
216int(19)
217-- Iteration 30 --
218int(49)
219int(49)
220int(49)
221int(49)
222-- Iteration 31 --
223bool(false)
224bool(false)
225bool(false)
226bool(false)
227-- Iteration 32 --
228bool(false)
229bool(false)
230bool(false)
231bool(false)
232-- Iteration 33 --
233bool(false)
234bool(false)
235bool(false)
236bool(false)
237-- Iteration 34 --
238int(0)
239bool(false)
240bool(false)
241int(0)
242