1--TEST--
2Test strrchr() function : usage variations - heredoc string containing special chars for 'haystack'
3--FILE--
4<?php
5/* Test strrchr() function by passing heredoc string containing special chars for haystack
6 * and with various needles
7*/
8
9echo "*** Testing strrchr() function: with heredoc strings ***\n";
10$special_chars_str = <<<EOD
11Example of heredoc string contains
12$#%^*&*_("_")!#@@!$#$^^&*(special)
13chars.
14EOD;
15
16$heredoc_needle = <<<EOD
17^^&*(
18EOD;
19
20$needles = array(
21  "!@@!",
22  '_',
23  '("_")',
24  "$*",
25  "(special)",
26  $heredoc_needle,  //needle as heredoc string
27  $special_chars_str  //needle as haystack
28);
29
30//loop through to test strrchr() with each needle
31foreach($needles as $needle) {
32  var_dump( strrchr($special_chars_str, $needle) );
33}
34echo "*** Done ***";
35?>
36--EXPECT--
37*** Testing strrchr() function: with heredoc strings ***
38string(24) "!$#$^^&*(special)
39chars."
40string(31) "_")!#@@!$#$^^&*(special)
41chars."
42string(16) "(special)
43chars."
44string(21) "$^^&*(special)
45chars."
46string(16) "(special)
47chars."
48string(19) "^&*(special)
49chars."
50string(76) "Example of heredoc string contains
51$#%^*&*_("_")!#@@!$#$^^&*(special)
52chars."
53*** Done ***
54