1--TEST--
2Test stripos() function : usage variations - repetitive chars for 'haystack' argument
3--FILE--
4<?php
5/* Test stripos() function with strings containing repetitive chars for haystak
6 *  and with various needles & offsets
7*/
8
9echo "*** Testing stripos() function: strings repetitive chars ***\n";
10$haystack = "aBAbaBAbaBabAbAbaBa";
11$needles = array(
12  "aba",
13  "aBA",
14  "ABA",
15  "Aba",
16  "BAb",
17  "bab",
18  "bAb",
19  "BAB"
20);
21
22/* loop through to consider various offsets in getting the position of the needle in haystack string */
23$count = 1;
24for($index = 0; $index < count($needles); $index++) {
25  echo "\n-- Iteration $count --\n";
26  for($offset = 0; $offset <= strlen($haystack); $offset++ ) {
27    var_dump( stripos($haystack, $needles[$index], $offset) );
28  }
29  $count++;
30}
31echo "*** Done ***";
32?>
33--EXPECT--
34*** Testing stripos() function: strings repetitive chars ***
35
36-- Iteration 1 --
37int(0)
38int(2)
39int(2)
40int(4)
41int(4)
42int(6)
43int(6)
44int(8)
45int(8)
46int(10)
47int(10)
48int(12)
49int(12)
50int(14)
51int(14)
52int(16)
53int(16)
54bool(false)
55bool(false)
56bool(false)
57
58-- Iteration 2 --
59int(0)
60int(2)
61int(2)
62int(4)
63int(4)
64int(6)
65int(6)
66int(8)
67int(8)
68int(10)
69int(10)
70int(12)
71int(12)
72int(14)
73int(14)
74int(16)
75int(16)
76bool(false)
77bool(false)
78bool(false)
79
80-- Iteration 3 --
81int(0)
82int(2)
83int(2)
84int(4)
85int(4)
86int(6)
87int(6)
88int(8)
89int(8)
90int(10)
91int(10)
92int(12)
93int(12)
94int(14)
95int(14)
96int(16)
97int(16)
98bool(false)
99bool(false)
100bool(false)
101
102-- Iteration 4 --
103int(0)
104int(2)
105int(2)
106int(4)
107int(4)
108int(6)
109int(6)
110int(8)
111int(8)
112int(10)
113int(10)
114int(12)
115int(12)
116int(14)
117int(14)
118int(16)
119int(16)
120bool(false)
121bool(false)
122bool(false)
123
124-- Iteration 5 --
125int(1)
126int(1)
127int(3)
128int(3)
129int(5)
130int(5)
131int(7)
132int(7)
133int(9)
134int(9)
135int(11)
136int(11)
137int(13)
138int(13)
139int(15)
140int(15)
141bool(false)
142bool(false)
143bool(false)
144bool(false)
145
146-- Iteration 6 --
147int(1)
148int(1)
149int(3)
150int(3)
151int(5)
152int(5)
153int(7)
154int(7)
155int(9)
156int(9)
157int(11)
158int(11)
159int(13)
160int(13)
161int(15)
162int(15)
163bool(false)
164bool(false)
165bool(false)
166bool(false)
167
168-- Iteration 7 --
169int(1)
170int(1)
171int(3)
172int(3)
173int(5)
174int(5)
175int(7)
176int(7)
177int(9)
178int(9)
179int(11)
180int(11)
181int(13)
182int(13)
183int(15)
184int(15)
185bool(false)
186bool(false)
187bool(false)
188bool(false)
189
190-- Iteration 8 --
191int(1)
192int(1)
193int(3)
194int(3)
195int(5)
196int(5)
197int(7)
198int(7)
199int(9)
200int(9)
201int(11)
202int(11)
203int(13)
204int(13)
205int(15)
206int(15)
207bool(false)
208bool(false)
209bool(false)
210bool(false)
211*** Done ***
212