1--TEST--
2Test strrpos() function : usage variations - heredoc string containing special chars for 'haystack' argument
3--FILE--
4<?php
5/* Prototype  : int strrpos ( string $haystack, string $needle [, int $offset] );
6 * Description: Find position of last occurrence of 'needle' in 'haystack'.
7 * Source code: ext/standard/string.c
8*/
9
10/* Test strrpos() function by passing heredoc string containing special chars for haystack
11 *  and with various needles & offets
12*/
13
14echo "*** Testing strrpos() function: with heredoc strings ***\n";
15echo "-- With heredoc string containing special chars --\n";
16$special_chars_str = <<<EOD
17Ex'ple of h'doc st'g, contains
18$#%^*&*_("_")!#@@!$#$^^&$*(special)
19chars.
20EOD;
21var_dump( strrpos($special_chars_str, "Ex'ple", 0) );
22var_dump( strrpos($special_chars_str, "!@@!", 23) );
23var_dump( strrpos($special_chars_str, '_') );
24var_dump( strrpos($special_chars_str, '("_")') );
25var_dump( strrpos($special_chars_str, "$*") );
26var_dump( strrpos($special_chars_str, "$*", 10) );
27var_dump( strrpos($special_chars_str, "(special)") );
28
29echo "*** Done ***";
30?>
31--EXPECT--
32*** Testing strrpos() function: with heredoc strings ***
33-- With heredoc string containing special chars --
34int(0)
35bool(false)
36int(41)
37int(39)
38int(55)
39int(55)
40int(57)
41*** Done ***
42