Annotation of embedaddon/php/ext/standard/tests/strings/strripos_basic2.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test strripos() function : basic functionality - with all arguments
! 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: echo "*** Testing strripos() function: basic functionality ***\n";
! 11: $heredoc_str = <<<EOD
! 12: Hello, World
! 13: EOD;
! 14:
! 15: echo "\n-- regular string for haystack & needle, with various offsets --\n";
! 16: var_dump( strripos("Hello, World", "HeLLo", 0) );
! 17: var_dump( strripos("Hello, World", 'Hello', 1) );
! 18: var_dump( strripos('Hello, World', 'world', 1) );
! 19: var_dump( strripos('Hello, World', "WorLD", 5) );
! 20:
! 21: echo "\n-- heredoc string for haystack & needle, with various offsets --\n";
! 22: var_dump( strripos($heredoc_str, "Hello, WORLD", 0) );
! 23: var_dump( strripos($heredoc_str, 'HelLo', 0) );
! 24: var_dump( strripos($heredoc_str, 'HeLLo', 1) );
! 25: var_dump( strripos($heredoc_str, $heredoc_str, 0) );
! 26: var_dump( strripos($heredoc_str, $heredoc_str, 1) );
! 27:
! 28: echo "\n-- various +ve offsets --\n";
! 29: var_dump( strripos("Hello, World", "O", 3) );
! 30: var_dump( strripos("Hello, World", "O", 6) );
! 31: var_dump( strripos("Hello, World", "O", 10) );
! 32:
! 33: echo "\n-- various -ve offsets --\n";
! 34: var_dump( strripos("Hello, World", "O", -1) );
! 35: var_dump( strripos("Hello, World", "O", -5) );
! 36: var_dump( strripos("Hello, World", "O", -9) );
! 37: ?>
! 38: ===DONE===
! 39: --EXPECT--
! 40: *** Testing strripos() function: basic functionality ***
! 41:
! 42: -- regular string for haystack & needle, with various offsets --
! 43: int(0)
! 44: bool(false)
! 45: int(7)
! 46: int(7)
! 47:
! 48: -- heredoc string for haystack & needle, with various offsets --
! 49: int(0)
! 50: int(0)
! 51: bool(false)
! 52: int(0)
! 53: bool(false)
! 54:
! 55: -- various +ve offsets --
! 56: int(8)
! 57: int(8)
! 58: bool(false)
! 59:
! 60: -- various -ve offsets --
! 61: int(8)
! 62: int(4)
! 63: bool(false)
! 64: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>