What is the usage of php mb strpos

藏色散人
Release: 2023-03-14 13:00:02
Original
2478 people have browsed it

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...".

What is the usage of php mb strpos

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
Copy after login

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!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!