mb_strpos( string $haystack, string $needle, int $offset, string $encoding = '' )
Fallback implementation of mb_strpos(), 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
(int|false) Position of needle in haystack if found, else false.
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;
}
}
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.