1--TEST--
2Test strrchr() function : basic functionality
3--FILE--
4<?php
5echo "*** Testing strrchr() function: basic functionality ***\n";
6var_dump( strrchr("Hello, World", "H") ); //needle as single char
7var_dump( strrchr("Hello, World", "Hello") ); //needle as a first word of haystack
8var_dump( strrchr('Hello, World', 'H') );
9var_dump( strrchr('Hello, World', 'Hello') );
10
11//considering case
12var_dump( strrchr("Hello, World", "h") );
13var_dump( strrchr("Hello, World", "hello") );
14
15//needle as second word of haystack
16var_dump( strrchr("Hello, World", "World") );
17var_dump( strrchr('Hello, World', 'World') );
18
19//needle as special char
20var_dump( strrchr("Hello, World", ",") );
21var_dump( strrchr('Hello, World', ',') );
22
23var_dump( strrchr("Hello, World", "Hello, World") ); //needle as haystack
24
25//needle string containing one existing and one non-existing char
26var_dump( strrchr("Hello, World", "Hi") );
27
28//multiple existence of needle in haystack
29var_dump( strrchr("Hello, World", "o") );
30var_dump( strrchr("Hello, World", "ooo") );
31
32var_dump( strrchr("Hello, World", "Zzzz") ); //non-existent needle in haystack
33echo "*** Done ***";
34?>
35--EXPECT--
36*** Testing strrchr() function: basic functionality ***
37string(12) "Hello, World"
38string(12) "Hello, World"
39string(12) "Hello, World"
40string(12) "Hello, World"
41bool(false)
42bool(false)
43string(5) "World"
44string(5) "World"
45string(7) ", World"
46string(7) ", World"
47string(12) "Hello, World"
48string(12) "Hello, World"
49string(4) "orld"
50string(4) "orld"
51bool(false)
52*** Done ***
53