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

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


Description Description


Parameters 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: ''


Top ↑

Return Return

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


Top ↑

Source Source

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

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

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

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

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.