1--TEST--
2Test 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
10echo "*** Testing strrpos() function: basic functionality ***\n";
11$heredoc_str = <<<EOD
12Hello, World
13EOD;
14
15echo "-- With default arguments --\n";
16//regular string for haystack & needle
17var_dump( strrpos("Hello, World", "Hello") );
18var_dump( strrpos('Hello, World', "hello") );
19var_dump( strrpos("Hello, World", 'World') );
20var_dump( strrpos('Hello, World', 'WORLD') );
21
22//single char for needle
23var_dump( strrpos("Hello, World", "o") );
24var_dump( strrpos("Hello, World", ",") );
25
26//heredoc string for haystack & needle
27var_dump( strrpos($heredoc_str, "Hello, World") );
28var_dump( strrpos($heredoc_str, 'Hello') );
29var_dump( strrpos($heredoc_str, $heredoc_str) );
30
31echo "*** Done ***";
32?>
33--EXPECTF--
34*** Testing strrpos() function: basic functionality ***
35-- With default arguments --
36int(0)
37bool(false)
38int(7)
39bool(false)
40int(8)
41int(5)
42int(0)
43int(0)
44int(0)
45*** Done ***
46