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

1.1       misho       1: --TEST--
                      2: Test strrchr() function : usage variations - multi line heredoc string 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 multi-line heredoc string for haystack and
                     11:  *    with various needles
                     12: */
                     13: 
                     14: echo "*** Testing strrchr() function: with heredoc strings ***\n";
                     15: $multi_line_str = <<<EOD
                     16: Example of string
                     17: spanning multiple lines
                     18: using heredoc syntax.
                     19: EOD;
                     20: 
                     21: $needles = array(
                     22:   "ing", 
                     23:   "", 
                     24:   " ",
                     25:   $multi_line_str //needle as haystack 
                     26: );
                     27: 
                     28: //loop through to test strrchr() with each needle
                     29: foreach($needles as $needle) {  
                     30:   var_dump( strrchr($multi_line_str, $needle) );
                     31: }
                     32: 
                     33: echo "*** Done ***";
                     34: ?>
                     35: --EXPECTF--
                     36: *** Testing strrchr() function: with heredoc strings ***
                     37: string(19) "ing heredoc syntax."
                     38: bool(false)
                     39: string(8) " syntax."
                     40: string(63) "Example of string
                     41: spanning multiple lines
                     42: using heredoc syntax."
                     43: *** Done ***

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