Revision 20119,
1012 bytes
checked in by nanasess, 13 years ago
(diff) |
module 以下は svn:keywords を除外
|
-
Property svn:eol-style set to
LF
|
Line | |
---|
1 | --TEST-- |
---|
2 | Function -- strripos |
---|
3 | --SKIPIF-- |
---|
4 | <?php if (function_exists('strripos')) { echo 'skip'; } ?> |
---|
5 | --FILE-- |
---|
6 | <?php |
---|
7 | require_once 'PHP/Compat.php'; |
---|
8 | PHP_Compat::loadFunction('strripos'); |
---|
9 | |
---|
10 | $haystack = 'Cat Dinner Dog Lion Mouse Sheep Wolf Cat Dog Donut'; |
---|
11 | $needle = 'DOG'; |
---|
12 | |
---|
13 | // Simple |
---|
14 | var_dump(strripos($haystack, $needle)); |
---|
15 | |
---|
16 | // With offset |
---|
17 | var_dump(strripos($haystack, $needle, 3)); |
---|
18 | var_dump(strripos($haystack, $needle, 30)); |
---|
19 | var_dump(strripos($haystack, $needle, 50)); |
---|
20 | var_dump(strripos($haystack, $needle, -1)); |
---|
21 | var_dump(strripos($haystack, $needle, -10)); |
---|
22 | var_dump(strripos($haystack, $needle, -30)); |
---|
23 | var_dump(strripos($haystack, $needle, -50)); |
---|
24 | |
---|
25 | // Test for Bug xx |
---|
26 | var_dump(strripos($haystack, 'How about no')); |
---|
27 | |
---|
28 | // Test for negative offset scanning bug |
---|
29 | var_dump(strripos('abcdef', 'bc', -5)); |
---|
30 | var_dump(strripos('aaafrogaa', 'frog', -5)); |
---|
31 | |
---|
32 | // Bug #5049 |
---|
33 | var_dump(strripos('testing', 'test')); |
---|
34 | |
---|
35 | ?> |
---|
36 | --EXPECT-- |
---|
37 | int(41) |
---|
38 | int(41) |
---|
39 | int(41) |
---|
40 | bool(false) |
---|
41 | int(41) |
---|
42 | int(11) |
---|
43 | int(11) |
---|
44 | bool(false) |
---|
45 | bool(false) |
---|
46 | int(1) |
---|
47 | int(3) |
---|
48 | int(0) |
---|
Note: See
TracBrowser
for help on using the repository browser.