function Mbstring::mb_strrpos
1 call to Mbstring::mb_strrpos()
- Mbstring::mb_strripos in vendor/
symfony/ polyfill-mbstring/ Mbstring.php
File
-
vendor/
symfony/ polyfill-mbstring/ Mbstring.php, line 546
Class
- Mbstring
- Partial mbstring implementation in PHP, iconv based, UTF-8 centric.
Namespace
Symfony\Polyfill\MbstringCode
public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) {
$encoding = self::getEncoding($encoding);
if ('CP850' === $encoding || 'ASCII' === $encoding) {
return strrpos($haystack, $needle, $offset);
}
if ($offset != (int) $offset) {
$offset = 0;
}
elseif ($offset = (int) $offset) {
if ($offset < 0) {
if (0 > ($offset += self::mb_strlen($needle))) {
$haystack = self::mb_substr($haystack, 0, $offset, $encoding);
}
$offset = 0;
}
else {
$haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
}
}
$pos = '' !== $needle || 80000 > \PHP_VERSION_ID ? iconv_strrpos($haystack, $needle, $encoding) : self::mb_strlen($haystack, $encoding);
return false !== $pos ? $offset + $pos : false;
}