1--TEST-- 2Test stripos() function : error conditions 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: error conditions ***\n"; 11echo "\n-- With Zero arguments --"; 12var_dump( stripos() ); 13 14echo "\n-- With less than expected number of arguments --"; 15var_dump( stripos("String") ); 16 17echo "\n-- With more than expected number of arguments --"; 18var_dump( stripos("string", "String", 1, 'extra_arg') ); 19 20echo "\n-- Offset beyond the end of the string --"; 21var_dump( stripos("Hello World", "o", 12) ); 22 23echo "\n-- Offset before the start of the string --"; 24var_dump( stripos("Hello World", "o", -12) ); 25 26echo "*** Done ***"; 27?> 28--EXPECTF-- 29*** Testing stripos() function: error conditions *** 30 31-- With Zero arguments -- 32Warning: stripos() expects at least 2 parameters, 0 given in %s on line %d 33NULL 34 35-- With less than expected number of arguments -- 36Warning: stripos() expects at least 2 parameters, 1 given in %s on line %d 37NULL 38 39-- With more than expected number of arguments -- 40Warning: stripos() expects at most 3 parameters, 4 given in %s on line %d 41NULL 42 43-- Offset beyond the end of the string -- 44Warning: stripos(): Offset not contained in string in %s on line %d 45bool(false) 46 47-- Offset before the start of the string -- 48Warning: stripos(): Offset not contained in string in %s on line %d 49bool(false) 50*** Done *** 51