1--TEST-- 2Test stripos() function : basic functionality - with all arguments 3--FILE-- 4<?php 5/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] ); 6 * Description: Find position of first occurrence of a case-insensitive string 7 * Source code: ext/standard/string.c 8*/ 9 10echo "*** Testing stripos() function: basic functionality ***\n"; 11$heredoc_str = <<<Identifier 12Hello, World 13Identifier; 14 15echo "-- With all arguments --\n"; 16//regular string for haystack & needle, with various offsets 17var_dump( stripos("Hello, World", "Hello", 0) ); 18var_dump( stripos("Hello, World", 'Hello', 1) ); 19var_dump( stripos('Hello, World', 'WORLD', 1) ); 20var_dump( stripos('Hello, World', "WoRld", 5) ); 21var_dump( stripos('Hello, World', "WoRld", -6) ); 22var_dump( stripos('Hello, World', "WoRld", -3) ); 23var_dump( stripos('Hello, World', "WoRld", -12) ); 24 25//heredoc string for haystack & needle, with various offsets 26var_dump( stripos($heredoc_str, "Hello, World", 0) ); 27var_dump( stripos($heredoc_str, 'Hello', 0) ); 28var_dump( stripos($heredoc_str, 'Hello', 1) ); 29var_dump( stripos($heredoc_str, $heredoc_str, 0) ); 30var_dump( stripos($heredoc_str, $heredoc_str, 1) ); 31var_dump( stripos($heredoc_str, $heredoc_str, -strlen($heredoc_str)) ); 32var_dump( stripos($heredoc_str, $heredoc_str, -strlen($heredoc_str)+1) ); 33 34//various offsets 35var_dump( stripos("Hello, World", "o", 3) ); 36var_dump( stripos("Hello, World", "O", 5) ); 37var_dump( stripos("Hello, World", "o", 6) ); 38var_dump( stripos("Hello, World", "o", 10) ); 39var_dump( stripos("Hello, World", "o", -7) ); 40var_dump( stripos("Hello, World", "o", -8) ); 41var_dump( stripos("Hello, World", "o", -10) ); 42var_dump( stripos("Hello, World", "o", -4) ); 43var_dump( stripos("Hello, World", "o", -3) ); 44echo "*** Done ***"; 45?> 46--EXPECTF-- 47*** Testing stripos() function: basic functionality *** 48-- With all arguments -- 49int(0) 50bool(false) 51int(7) 52int(7) 53int(7) 54bool(false) 55int(7) 56int(0) 57int(0) 58bool(false) 59int(0) 60bool(false) 61int(0) 62bool(false) 63int(4) 64int(8) 65int(8) 66bool(false) 67int(8) 68int(4) 69int(4) 70int(8) 71bool(false) 72*** Done *** 73