1--TEST--
2strr[i]pos() function with negative offset
3--FILE--
4<?php
5    var_dump(strrpos("haysthack", 'ha', -9));
6    var_dump(strrpos("haystack", 'h', -8));
7    var_dump(strrpos("haystack", 'k', -1));
8    var_dump(strrpos("haystack", "ka", -1));
9    var_dump(strrpos("haystack", 'a', -3));
10    var_dump(strrpos("haystack", 'a', -4));
11    try {
12        strrpos("haystack", 'h', -9);
13    } catch (ValueError $exception) {
14        echo $exception->getMessage() . "\n";
15    }
16    var_dump(strripos("HAYSTHACk", 'ha', -9));
17    var_dump(strripos("HAYSTACK", 'h', -8));
18    var_dump(strripos("HAYSTACK", 'k', -1));
19    var_dump(strripos("HAYSTACK", "ka", -1));
20    var_dump(strripos("HAYSTACK", 'a', -3));
21    var_dump(strripos("HAYSTACK", 'a', -4));
22    try {
23        strripos("HAYSTACK", 'h', -9);
24    } catch (ValueError $exception) {
25        echo $exception->getMessage() . "\n";
26    }
27?>
28--EXPECT--
29int(0)
30int(0)
31int(7)
32bool(false)
33int(5)
34int(1)
35strrpos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
36int(0)
37int(0)
38int(7)
39bool(false)
40int(5)
41int(1)
42strripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
43