Annotation of embedaddon/php/ext/standard/tests/strings/strrpos_variation4.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test 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:
14: echo "*** Testing strrpos() function: with heredoc strings ***\n";
15: echo "-- With heredoc string containing special chars --\n";
16: $special_chars_str = <<<EOD
17: Ex'ple of h'doc st'g, contains
18: $#%^*&*_("_")!#@@!$#$^^&$*(special)
19: chars.
20: EOD;
21: var_dump( strrpos($special_chars_str, "Ex'ple", 0) );
22: var_dump( strrpos($special_chars_str, "!@@!", 23) );
23: var_dump( strrpos($special_chars_str, '_') );
24: var_dump( strrpos($special_chars_str, '("_")') );
25: var_dump( strrpos($special_chars_str, "$*") );
26: var_dump( strrpos($special_chars_str, "$*", 10) );
27: var_dump( strrpos($special_chars_str, "(special)") );
28:
29: echo "*** Done ***";
30: ?>
31: --EXPECTF--
32: *** Testing strrpos() function: with heredoc strings ***
33: -- With heredoc string containing special chars --
34: int(0)
35: bool(false)
36: int(41)
37: int(39)
38: int(55)
39: int(55)
40: int(57)
41: *** Done ***
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>