Annotation of embedaddon/php/ext/standard/tests/strings/strrchr_variation5.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test strrchr() function : usage variations - heredoc string containing escape sequences for 'haystack'
3: --FILE--
4: <?php
5: /* Prototype : string strrchr(string $haystack, string $needle);
6: * Description: Finds the last occurrence of a character in a string.
7: * Source code: ext/standard/string.c
8: */
9:
10: /* Test strrchr() function by passing heredoc string containing
11: * escape sequences for haystack and with various needles
12: */
13:
14: echo "*** Testing strrchr() function: with heredoc strings ***\n";
15: $escape_char_str = <<<EOD
16: \tes\t st\r\rch\r using
17: \escape \\seque\nce
18: EOD;
19:
20: $needles = array(
21: "\t",
22: '\n',
23: "\r",
24: "\\",
25: $escape_char_str //needle as haystack
26: );
27:
28: //loop through to test strrchr() with each needle
29: foreach($needles as $needle) {
30: var_dump( strrchr($escape_char_str, $needle) );
31: }
32:
33: echo "*** Done ***";
34: ?>
35: --EXPECTF--
36: *** Testing strrchr() function: with heredoc strings ***
37: string(33) " st
ch
using
38: \escape \seque
39: ce"
40: string(9) "\seque
41: ce"
42: string(25) "
using
43: \escape \seque
44: ce"
45: string(9) "\seque
46: ce"
47: string(33) " st
ch
using
48: \escape \seque
49: ce"
50: *** Done ***
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>