Return to strripos_basic1.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / strings |
1.1 misho 1: --TEST-- 2: Test strripos() function : basic functionality - with default arguments 3: --FILE-- 4: <?php 5: /* Prototype : int strripos ( string $haystack, string $needle [, int $offset] ); 6: * Description: Find position of last occurrence of a case-insensitive 'needle' in a 'haystack' 7: * Source code: ext/standard/string.c 8: */ 9: 10: echo "*** Testing strripos() function: basic functionality ***\n"; 11: $heredoc_str = <<<EOD 12: Hello, World 13: EOD; 14: 15: echo "\n-- regular string for haystack & needle --\n"; 16: var_dump( strripos("Hello, World", "HeLLo") ); 17: var_dump( strripos('Hello, World', "hello") ); 18: var_dump( strripos("Hello, World", 'WoRLd') ); 19: var_dump( strripos('Hello, World', 'WORLD') ); 20: var_dump( strripos('Hello, World', 'foo') ); 21: 22: echo "\n-- single char for needle --\n"; 23: var_dump( strripos("Hello, World", "O") ); 24: var_dump( strripos("Hello, World", ",") ); 25: 26: echo "\n-- heredoc string for haystack & needle --\n"; 27: var_dump( strripos($heredoc_str, "Hello, WoRLd") ); 28: var_dump( strripos($heredoc_str, 'HelLO') ); 29: var_dump( strripos($heredoc_str, $heredoc_str) ); 30: 31: ?> 32: ===DONE=== 33: --EXPECT-- 34: *** Testing strripos() function: basic functionality *** 35: 36: -- regular string for haystack & needle -- 37: int(0) 38: int(0) 39: int(7) 40: int(7) 41: bool(false) 42: 43: -- single char for needle -- 44: int(8) 45: int(5) 46: 47: -- heredoc string for haystack & needle -- 48: int(0) 49: int(0) 50: int(0) 51: ===DONE===