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