1--TEST--
2Test strrpos() function : usage variations - repetitive chars for 'haystack' argument
3--FILE--
4<?php
5/* Test strrpos() function with strings containing multiple occurrences of 'needle' in the 'haystack'
6 *  and with various needles & offsets
7*/
8
9echo "*** Testing strrpos() function: strings repetitive chars ***\n";
10$haystack = "ababababAbaBa";
11$needle = "aba";
12
13/* loop through to consider various offsets in getting the position of the needle in haystack string */
14$count = 1;
15for($offset = -1; $offset <= strlen($haystack); $offset++ ) {
16  echo "-- Iteration $count --\n";
17  var_dump( strrpos($haystack, $needle, $offset) );
18  $count++;
19}
20echo "*** Done ***";
21?>
22--EXPECT--
23*** Testing strrpos() function: strings repetitive chars ***
24-- Iteration 1 --
25int(4)
26-- Iteration 2 --
27int(4)
28-- Iteration 3 --
29int(4)
30-- Iteration 4 --
31int(4)
32-- Iteration 5 --
33int(4)
34-- Iteration 6 --
35int(4)
36-- Iteration 7 --
37bool(false)
38-- Iteration 8 --
39bool(false)
40-- Iteration 9 --
41bool(false)
42-- Iteration 10 --
43bool(false)
44-- Iteration 11 --
45bool(false)
46-- Iteration 12 --
47bool(false)
48-- Iteration 13 --
49bool(false)
50-- Iteration 14 --
51bool(false)
52-- Iteration 15 --
53bool(false)
54*** Done ***
55