php The mb_strpos function is used to find the first occurrence of a string in another string. Its usage syntax is "mb_strpos(string $haystack, string $needle, int $offset = 0...".
The operating environment of this article: Windows 7 system, PHP version 7.4, Dell G3 computer.
What is the usage of php mb_strpos?
mb_strpos
(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)
mb_strpos — Find The position where a string first appears in another string
Description
mb_strpos( string $haystack, string $needle, int $offset = 0, string $encoding = mb_internal_encoding() ): int
Find the position where string first appears in a string.
Perform a multi-word based on the number of characters Section-safe strpos() operation. The first character is at position 0, the second character is at position 1, and so on.
Parameters:
haystack
The string to be checked.
needle
Find this string in haystack. Unlike strpos(), numeric values are not treated as sequential values of characters.
offset
The offset of the search position. If this parameter is not provided, 0 will be used. Negative offsets will be counted from the end of the string.
encoding
encoding parameter is the character encoding. If omitted or null, the internal character encoding is used.
Return value
Returns the value of the first occurrence of needle in the haystack of string. If needle is not found , it will return false.
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of What is the usage of php mb strpos. For more information, please follow other related articles on the PHP Chinese website!