1--TEST--
2Test stripos() function : basic functionality - with default 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 default arguments --\n";
16//regular string for haystack & needle
17var_dump( stripos("Hello, World", "Hello") );
18var_dump( stripos('Hello, World', "hello") );
19var_dump( stripos("Hello, World", 'World') );
20var_dump( stripos('Hello, World', 'WORLD') );
21
22//single char for needle
23var_dump( stripos("Hello, World", "o") );
24var_dump( stripos("Hello, World", ",") );
25
26//heredoc string for haystack & needle
27var_dump( stripos($heredoc_str, "Hello, World") );
28var_dump( stripos($heredoc_str, 'Hello') );
29var_dump( stripos($heredoc_str, $heredoc_str) );
30
31//non-existing needle in haystack
32var_dump( stripos("Hello, World", "ooo") );
33echo "*** Done ***";
34?>
35--EXPECT--
36*** Testing stripos() function: basic functionality ***
37-- With default arguments --
38int(0)
39int(0)
40int(7)
41int(7)
42int(4)
43int(5)
44int(0)
45int(0)
46int(0)
47bool(false)
48*** Done ***
49