PHP stripos function
The PHP stripos function is used to determine the position of the key character in the original string. The first character position of the original string is numbered 0. The usage of the stripos function is the same as the strpos function , but the difference is the stripos function Will not actively distinguish the upper and lower case of English letters, which means that the English letter A and a are the same under the identification of the stripos function. If you need to make a judgment rule that can distinguish the upper and lower case of English letters, please use the strpos function to process It will be easier.
PHP stripos function syntax
int stripos (string $haystack, string $needle, int $offset = 0)
The first parameter of the stripos function, $haystack, is the original string, which is the string to be queried, and the second parameter, $needle, is the key character. Stripost will query $haystack according to $needle. If the matching result is found, it will return to the position. It should be noted that the first character of the original string is counted from 0. If the stripos function does not find a matching result in the original string, It returns false or a non-Boolean value equivalent to false. The third parameter $offset is a selection item, which is used to specify the position from which the stripos function is to be calculated, also known as the offset. The returned key character position is relative to the original string position.
PHP stripos function example
echo stripos('Welcome to wibibi.Have a good day.','w').'<br>';
echo stripos('Welcome to wibibi.Have a good day.','w',2) ;
?>
11
Post a Comment
0 Comments