Annotation of embedaddon/php/ext/standard/tests/strings/stripos_basic1.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test stripos() function : basic functionality - with default 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 default arguments --\n";
! 16: //regular string for haystack & needle
! 17: var_dump( stripos("Hello, World", "Hello") );
! 18: var_dump( stripos('Hello, World', "hello") );
! 19: var_dump( stripos("Hello, World", 'World') );
! 20: var_dump( stripos('Hello, World', 'WORLD') );
! 21:
! 22: //single char for needle
! 23: var_dump( stripos("Hello, World", "o") );
! 24: var_dump( stripos("Hello, World", ",") );
! 25:
! 26: //heredoc string for haystack & needle
! 27: var_dump( stripos($heredoc_str, "Hello, World") );
! 28: var_dump( stripos($heredoc_str, 'Hello') );
! 29: var_dump( stripos($heredoc_str, $heredoc_str) );
! 30:
! 31: //non-existing needle in haystack
! 32: var_dump( stripos("Hello, World", "ooo") );
! 33: echo "*** Done ***";
! 34: ?>
! 35: --EXPECTF--
! 36: *** Testing stripos() function: basic functionality ***
! 37: -- With default arguments --
! 38: int(0)
! 39: int(0)
! 40: int(7)
! 41: int(7)
! 42: int(4)
! 43: int(5)
! 44: int(0)
! 45: int(0)
! 46: int(0)
! 47: bool(false)
! 48: *** Done ***
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>