1--TEST--
2Test strripos() function : usage variations - multi line heredoc string for 'haystack' argument
3--FILE--
4<?php
5/* Prototype  : int strripos ( string $haystack, string $needle [, int $offset] );
6 * Description: Find position of last occurrence of a case-insensitive 'needle' in a 'haystack'
7 * Source code: ext/standard/string.c
8*/
9
10/* Test strripos() function by passing multi-line heredoc string for haystack and
11 *  with various needles & offsets
12*/
13
14echo "*** Testing strripos() function: with heredoc strings ***\n";
15echo "-- With heredoc string containing multi lines --\n";
16$multi_line_str = <<<EOD
17Example of string
18spanning multiple lines
19using heredoc syntax.
20EOD;
21
22echo "\n-- Multi line strings with +ve offsets -- \n";
23var_dump( strripos($multi_line_str, "iNg", 0) );
24var_dump( strripos($multi_line_str, "inG", 15) );
25var_dump( strripos($multi_line_str, "Ing", 22) );
26
27echo "\n-- Multi line strings with +ve offsets -- \n";
28var_dump( strripos($multi_line_str, "Ing", -1) );
29var_dump( strripos($multi_line_str, "Ing", -17) );
30var_dump( strripos($multi_line_str, "Ing", -50) );
31
32echo "\n-- Multi line strings with no offset -- \n";
33var_dump( strripos($multi_line_str, "spAn") );
34var_dump( strripos($multi_line_str, "IPlE") );
35var_dump( strripos($multi_line_str, "") );
36var_dump( strripos($multi_line_str, " ") );
37
38?>
39===DONE===
40--EXPECT--
41*** Testing strripos() function: with heredoc strings ***
42-- With heredoc string containing multi lines --
43
44-- Multi line strings with +ve offsets --
45int(44)
46int(44)
47int(44)
48
49-- Multi line strings with +ve offsets --
50int(44)
51int(44)
52bool(false)
53
54-- Multi line strings with no offset --
55int(18)
56int(31)
57bool(false)
58int(55)
59===DONE===
60