1--TEST--
2Test stripos() function : basic functionality - with all arguments
3--FILE--
4<?php
5/* Prototype  : int stripos ( string $haystack, string $needle [, int $offset] );
6 * Description: Find position of first occurrence of a case-insensitive string
7 * Source code: ext/standard/string.c
8*/
9
10echo "*** Testing stripos() function: basic functionality ***\n";
11$heredoc_str = <<<Identifier
12Hello, World
13Identifier;
14
15echo "-- With all arguments --\n";
16//regular string for haystack & needle, with various offsets
17var_dump( stripos("Hello, World", "Hello", 0) );
18var_dump( stripos("Hello, World", 'Hello', 1) );
19var_dump( stripos('Hello, World', 'WORLD', 1) );
20var_dump( stripos('Hello, World', "WoRld", 5) );
21
22//heredoc string for haystack & needle, with various offsets
23var_dump( stripos($heredoc_str, "Hello, World", 0) );
24var_dump( stripos($heredoc_str, 'Hello', 0) );
25var_dump( stripos($heredoc_str, 'Hello', 1) );
26var_dump( stripos($heredoc_str, $heredoc_str, 0) );
27var_dump( stripos($heredoc_str, $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) );
34echo "*** Done ***";
35?>
36--EXPECTF--
37*** Testing stripos() function: basic functionality ***
38-- With all arguments --
39int(0)
40bool(false)
41int(7)
42int(7)
43int(0)
44int(0)
45bool(false)
46int(0)
47bool(false)
48int(4)
49int(8)
50int(8)
51bool(false)
52*** Done ***
53