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

1.1       misho       1: --TEST--
                      2: Test strripos() function : usage variations - multi line heredoc string for 'haystack' argument
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : int strripos ( string $haystack, string $needle [, int $offset] );
                      6:  * Description: Find position of last occurrence of a case-insensitive 'needle' in a 'haystack'
                      7:  * Source code: ext/standard/string.c
                      8: */
                      9: 
                     10: /* Test strripos() function by passing multi-line heredoc string for haystack and 
                     11:  *  with various needles & offsets
                     12: */
                     13: 
                     14: echo "*** Testing strripos() function: with heredoc strings ***\n";
                     15: echo "-- With heredoc string containing multi lines --\n";
                     16: $multi_line_str = <<<EOD
                     17: Example of string
                     18: spanning multiple lines
                     19: using heredoc syntax.
                     20: EOD;
                     21: 
                     22: echo "\n-- Multi line strings with +ve offsets -- \n";
                     23: var_dump( strripos($multi_line_str, "iNg", 0) );
                     24: var_dump( strripos($multi_line_str, "inG", 15) );
                     25: var_dump( strripos($multi_line_str, "Ing", 22) );
                     26: 
                     27: echo "\n-- Multi line strings with +ve offsets -- \n";
                     28: var_dump( strripos($multi_line_str, "Ing", -1) );
                     29: var_dump( strripos($multi_line_str, "Ing", -17) );
                     30: var_dump( strripos($multi_line_str, "Ing", -50) );
                     31: 
                     32: echo "\n-- Multi line strings with no offset -- \n";
                     33: var_dump( strripos($multi_line_str, "spAn") );
                     34: var_dump( strripos($multi_line_str, "IPlE") );
                     35: var_dump( strripos($multi_line_str, "") );
                     36: var_dump( strripos($multi_line_str, " ") );
                     37: 
                     38: ?>
                     39: ===DONE===
                     40: --EXPECT--
                     41: *** Testing strripos() function: with heredoc strings ***
                     42: -- With heredoc string containing multi lines --
                     43: 
                     44: -- Multi line strings with +ve offsets -- 
                     45: int(44)
                     46: int(44)
                     47: int(44)
                     48: 
                     49: -- Multi line strings with +ve offsets -- 
                     50: int(44)
                     51: int(44)
                     52: bool(false)
                     53: 
                     54: -- Multi line strings with no offset -- 
                     55: int(18)
                     56: int(31)
                     57: bool(false)
                     58: int(55)
                     59: ===DONE===

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