1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
--TEST--
Test stripos() function : error conditions
--FILE--
<?php
echo "*** Testing stripos() function: error conditions ***\n";
echo "\n-- Offset beyond the end of the string --\n";
try {
stripos("Hello World", "o", 12);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
echo "\n-- Offset before the start of the string --\n";
try {
stripos("Hello World", "o", -12);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
echo "*** Done ***";
?>
--EXPECT--
*** Testing stripos() function: error conditions ***
-- Offset beyond the end of the string --
stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
-- Offset before the start of the string --
stripos(): Argument #3 ($offset) must be contained in argument #1 ($haystack)
*** Done ***
|