Annotation of embedaddon/php/ext/standard/tests/strings/strrpos_basic2.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test strrpos() function : basic functionality - with all arguments
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
! 6: * Description: Find position of last occurrence of 'needle' in 'haystack'
! 7: * Source code: ext/standard/string.c
! 8: */
! 9:
! 10: echo "*** Testing strrpos() function: basic functionality ***\n";
! 11: $heredoc_str = <<<EOD
! 12: Hello, World
! 13: EOD;
! 14:
! 15: echo "-- With all arguments --\n";
! 16: //regular string for haystack & needle, with various offsets
! 17: var_dump( strrpos("Hello, World", "Hello", 0) );
! 18: var_dump( strrpos("Hello, World", 'Hello', 1) );
! 19: var_dump( strrpos('Hello, World', 'World', 1) );
! 20: var_dump( strrpos('Hello, World', "World", 5) );
! 21:
! 22: //heredoc string for haystack & needle, with various offsets
! 23: var_dump( strrpos($heredoc_str, "Hello, World", 0) );
! 24: var_dump( strrpos($heredoc_str, 'Hello', 0) );
! 25: var_dump( strrpos($heredoc_str, 'Hello', 1) );
! 26: var_dump( strrpos($heredoc_str, $heredoc_str, 0) );
! 27: var_dump( strrpos($heredoc_str, $heredoc_str, 1) );
! 28:
! 29: //various offsets
! 30: var_dump( strrpos("Hello, World", "o", 3) );
! 31: var_dump( strrpos("Hello, World", "o", 6) );
! 32: var_dump( strrpos("Hello, World", "o", 10) );
! 33: echo "*** Done ***";
! 34: ?>
! 35: --EXPECTF--
! 36: *** Testing strrpos() function: basic functionality ***
! 37: -- With all arguments --
! 38: int(0)
! 39: bool(false)
! 40: int(7)
! 41: int(7)
! 42: int(0)
! 43: int(0)
! 44: bool(false)
! 45: int(0)
! 46: bool(false)
! 47: int(8)
! 48: int(8)
! 49: bool(false)
! 50: *** Done ***
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>