1--TEST-- 2Test strripos() function : basic functionality - with all 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 10echo "*** Testing strripos() function: basic functionality ***\n"; 11$heredoc_str = <<<EOD 12Hello, World 13EOD; 14 15echo "\n-- regular string for haystack & needle, with various offsets --\n"; 16var_dump( strripos("Hello, World", "HeLLo", 0) ); 17var_dump( strripos("Hello, World", 'Hello', 1) ); 18var_dump( strripos('Hello, World', 'world', 1) ); 19var_dump( strripos('Hello, World', "WorLD", 5) ); 20 21echo "\n-- heredoc string for haystack & needle, with various offsets --\n"; 22var_dump( strripos($heredoc_str, "Hello, WORLD", 0) ); 23var_dump( strripos($heredoc_str, 'HelLo', 0) ); 24var_dump( strripos($heredoc_str, 'HeLLo', 1) ); 25var_dump( strripos($heredoc_str, $heredoc_str, 0) ); 26var_dump( strripos($heredoc_str, $heredoc_str, 1) ); 27 28echo "\n-- various +ve offsets --\n"; 29var_dump( strripos("Hello, World", "O", 3) ); 30var_dump( strripos("Hello, World", "O", 6) ); 31var_dump( strripos("Hello, World", "O", 10) ); 32 33echo "\n-- various -ve offsets --\n"; 34var_dump( strripos("Hello, World", "O", -1) ); 35var_dump( strripos("Hello, World", "O", -5) ); 36var_dump( strripos("Hello, World", "O", -9) ); 37?> 38===DONE=== 39--EXPECT-- 40*** Testing strripos() function: basic functionality *** 41 42-- regular string for haystack & needle, with various offsets -- 43int(0) 44bool(false) 45int(7) 46int(7) 47 48-- heredoc string for haystack & needle, with various offsets -- 49int(0) 50int(0) 51bool(false) 52int(0) 53bool(false) 54 55-- various +ve offsets -- 56int(8) 57int(8) 58bool(false) 59 60-- various -ve offsets -- 61int(8) 62int(4) 63bool(false) 64===DONE=== 65