Annotation of embedaddon/php/ext/standard/tests/strings/strrchr_variation6.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test 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: 
                     14: echo "*** Testing strrchr() function: with heredoc strings ***\n";
                     15: $quote_char_str = <<<EOD
                     16: "things" "in" "double" "quote"
                     17: 'things' 'in' 'single' 'quote'
                     18: EOD;
                     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
                     30: foreach($needles as $needle) {
                     31:   var_dump( strrchr($quote_char_str, $needle) );
                     32: }
                     33: echo "*** Done ***";
                     34: ?>
                     35: --EXPECTF--
                     36: *** Testing strrchr() function: with heredoc strings ***
                     37: string(3) "te'"
                     38: string(32) ""
                     39: 'things' 'in' 'single' 'quote'"
                     40: bool(false)
                     41: string(14) "ingle' 'quote'"
                     42: string(6) "quote'"
                     43: string(32) ""
                     44: 'things' 'in' 'single' 'quote'"
                     45: *** Done ***

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>