1--TEST--
2Test stripos() function : basic functionality - with all arguments
3--FILE--
4<?php
5echo "*** Testing stripos() function: basic functionality ***\n";
6$heredoc_str = <<<Identifier
7Hello, World
8Identifier;
9
10echo "-- With all arguments --\n";
11//regular string for haystack & needle, with various offsets
12var_dump( stripos("Hello, World", "Hello", 0) );
13var_dump( stripos("Hello, World", 'Hello', 1) );
14var_dump( stripos('Hello, World', 'WORLD', 1) );
15var_dump( stripos('Hello, World', "WoRld", 5) );
16var_dump( stripos('Hello, World', "WoRld", -6) );
17var_dump( stripos('Hello, World', "WoRld", -3) );
18var_dump( stripos('Hello, World', "WoRld", -12) );
19
20//heredoc string for haystack & needle, with various offsets
21var_dump( stripos($heredoc_str, "Hello, World", 0) );
22var_dump( stripos($heredoc_str, 'Hello', 0) );
23var_dump( stripos($heredoc_str, 'Hello', 1) );
24var_dump( stripos($heredoc_str, $heredoc_str, 0) );
25var_dump( stripos($heredoc_str, $heredoc_str, 1) );
26var_dump( stripos($heredoc_str, $heredoc_str, -strlen($heredoc_str)) );
27var_dump( stripos($heredoc_str, $heredoc_str, -strlen($heredoc_str)+1) );
28
29//various offsets
30var_dump( stripos("Hello, World", "o", 3) );
31var_dump( stripos("Hello, World", "O", 5) );
32var_dump( stripos("Hello, World", "o", 6) );
33var_dump( stripos("Hello, World", "o", 10) );
34var_dump( stripos("Hello, World", "o", -7) );
35var_dump( stripos("Hello, World", "o", -8) );
36var_dump( stripos("Hello, World", "o", -10) );
37var_dump( stripos("Hello, World", "o", -4) );
38var_dump( stripos("Hello, World", "o", -3) );
39echo "*** Done ***";
40?>
41--EXPECT--
42*** Testing stripos() function: basic functionality ***
43-- With all arguments --
44int(0)
45bool(false)
46int(7)
47int(7)
48int(7)
49bool(false)
50int(7)
51int(0)
52int(0)
53bool(false)
54int(0)
55bool(false)
56int(0)
57bool(false)
58int(4)
59int(8)
60int(8)
61bool(false)
62int(8)
63int(4)
64int(4)
65int(8)
66bool(false)
67*** Done ***
68