1--TEST--
2Test strrchr() function : usage variations - heredoc string containing quote chars 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 quote chars for haystack
11 *  and with various needles
12*/
13
14echo "*** Testing strrchr() function: with heredoc strings ***\n";
15$quote_char_str = <<<EOD
16"things" "in" "double" "quote"
17'things' 'in' 'single' 'quote'
18EOD;
19
20$needles = array(
21  "things",
22  "\"things\"",
23  "\'things\'",
24  "in",
25  "quote",
26  $quote_char_str //needle as haystack
27);
28
29//loop through to test strrchr() with each needle
30foreach($needles as $needle) {
31  var_dump( strrchr($quote_char_str, $needle) );
32}
33echo "*** Done ***";
34?>
35--EXPECT--
36*** Testing strrchr() function: with heredoc strings ***
37string(3) "te'"
38string(32) ""
39'things' 'in' 'single' 'quote'"
40bool(false)
41string(14) "ingle' 'quote'"
42string(6) "quote'"
43string(32) ""
44'things' 'in' 'single' 'quote'"
45*** Done ***
46