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