1
0
mirror of https://github.com/php/php-src.git synced 2026-03-30 20:22:36 +02:00
Files
archived-php-src/ext/standard/tests/strings/stripos_error.phpt
2019-03-11 11:32:20 +01:00

31 lines
883 B
PHP

--TEST--
Test stripos() function : error conditions
--FILE--
<?php
/* Prototype : int stripos ( string $haystack, string $needle [, int $offset] );
* Description: Find position of first occurrence of a case-insensitive string
* Source code: ext/standard/string.c
*/
echo "*** Testing stripos() function: error conditions ***\n";
echo "\n-- Offset beyond the end of the string --";
var_dump( stripos("Hello World", "o", 12) );
echo "\n-- Offset before the start of the string --";
var_dump( stripos("Hello World", "o", -12) );
echo "*** Done ***";
?>
--EXPECTF--
*** Testing stripos() function: error conditions ***
-- Offset beyond the end of the string --
Warning: stripos(): Offset not contained in string in %s on line %d
bool(false)
-- Offset before the start of the string --
Warning: stripos(): Offset not contained in string in %s on line %d
bool(false)
*** Done ***