mb_strrpos( string $haystack, string $needle, int $offset, string $encoding = '' )

Fallback implementation of mb_strrpos(), hardcoded to UTF-8.

Description

Parameters

$haystack

(Required) String to search in.

$needle

(Required) String to search for.

$offset

(Optional) Start position for the search. Default: 0.

$encoding

(Optional) Encoding type. Ignored.

Default value: ''

Return

(string|false) Position of last needle in haystack if found, else false.

Source

File: bp-core/bp-core-wpabstraction.php

	function mb_strrpos( $haystack, $needle, $offset = 0, $encoding = '' ) {
		$needle = preg_quote( $needle, '/' );

		$ar = array();
		preg_match_all( '/' . $needle . '/u', $haystack, $ar, PREG_OFFSET_CAPTURE, $offset );

		if( isset( $ar[0] ) && count( $ar[0] ) > 0 &&
			isset( $ar[0][count( $ar[0] ) - 1][1] ) ) {
			return $ar[0][count( $ar[0] ) - 1][1];
		} else {
			return false;
		}
	}

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.