1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
--TEST--
Test strrpos() function : basic functionality - with default arguments
--FILE--
<?php
/* Prototype : int strrpos ( string $haystack, string $needle [, int $offset] );
* Description: Find position of last occurrence of 'needle' in 'haystack'
* Source code: ext/standard/string.c
*/
echo "*** Testing strrpos() function: basic functionality ***\n";
$heredoc_str = <<<EOD
Hello, World
EOD;
echo "-- With default arguments --\n";
//regular string for haystack & needle
var_dump( strrpos("Hello, World", "Hello") );
var_dump( strrpos('Hello, World', "hello") );
var_dump( strrpos("Hello, World", 'World') );
var_dump( strrpos('Hello, World', 'WORLD') );
//single char for needle
var_dump( strrpos("Hello, World", "o") );
var_dump( strrpos("Hello, World", ",") );
//heredoc string for haystack & needle
var_dump( strrpos($heredoc_str, "Hello, World") );
var_dump( strrpos($heredoc_str, 'Hello') );
var_dump( strrpos($heredoc_str, $heredoc_str) );
//unicodes
var_dump( strrpos("Hello, World", (unicode)"o") );
var_dump( strrpos((unicode)"Hello, World", ",") );
echo "*** Done ***";
?>
--EXPECT--
*** Testing strrpos() function: basic functionality ***
-- With default arguments --
int(0)
bool(false)
int(7)
bool(false)
int(8)
int(5)
int(0)
int(0)
int(0)
int(8)
int(5)
*** Done ***
|