跳转到主要内容

mb-strrpos

mb_strrpos

Find position of last occurrence of a string in a string

ENTITY

int

false

mb_strrpos

string

haystack

string

needle

int

offset

0

string

null

encoding

ENTITY

Performs a multibyte safe strrpos operation based on the number of characters. needle position is counted from the beginning of haystack. First character's position is 0. Second character position is 1.

ENTITY

haystack
The string being checked, for the last occurrence of needle

needle
The string to find in haystack.

offset
May be specified to begin searching an arbitrary number of characters into the haystack. Negative values will stop searching at an arbitrary point prior to the end of the haystack.

encoding
ENTITY

ENTITY

Returns the numeric position of the last occurrence of needle in the haystack string. If needle is not found, it returns ENTITY.

ENTITY

  • If offset is greater than the length of haystack, a ValueError will be thrown.

ENTITY

ENTITY

ENTITY ENTITY
8.0.0 Passing the encoding as the third argument instead of an offset has been removed.

ENTITY

mb_strpos, mb_internal_encoding, strrpos