|
@@ 4631-4637 (lines=7) @@
|
| 4628 |
|
$encoding = self::normalize_encoding($encoding); |
| 4629 |
|
} |
| 4630 |
|
|
| 4631 |
|
if ( |
| 4632 |
|
$encoding == 'UTF-8' // INFO: "grapheme_stripos()" can't handle other encodings |
| 4633 |
|
|| |
| 4634 |
|
self::$support['intl'] === true |
| 4635 |
|
) { |
| 4636 |
|
return \grapheme_stripos($haystack, $needle, $offset); |
| 4637 |
|
} |
| 4638 |
|
|
| 4639 |
|
// fallback to "mb_"-function via polyfill |
| 4640 |
|
return \mb_stripos($haystack, $needle, $offset, $encoding); |
|
@@ 4674-4680 (lines=7) @@
|
| 4671 |
|
$haystack = self::clean($haystack); |
| 4672 |
|
} |
| 4673 |
|
|
| 4674 |
|
if ( |
| 4675 |
|
$encoding !== 'UTF-8' // INFO: use "mb_"-function (with polyfill) also if we need another encoding |
| 4676 |
|
|| |
| 4677 |
|
self::$support['mbstring'] === true |
| 4678 |
|
) { |
| 4679 |
|
return \mb_stristr($haystack, $needle, $before_needle, $encoding); |
| 4680 |
|
} |
| 4681 |
|
|
| 4682 |
|
if (self::$support['intl'] === true) { |
| 4683 |
|
return \grapheme_stristr($haystack, $needle, $before_needle); |
|
@@ 4927-4933 (lines=7) @@
|
| 4924 |
|
$encoding = self::normalize_encoding($encoding); |
| 4925 |
|
} |
| 4926 |
|
|
| 4927 |
|
if ( |
| 4928 |
|
$encoding !== 'UTF-8' // INFO: use "mb_"-function (with polyfill) also if we need another encoding |
| 4929 |
|
|| |
| 4930 |
|
self::$support['mbstring'] === true |
| 4931 |
|
) { |
| 4932 |
|
return \mb_strpos($haystack, $needle, $offset, $encoding); |
| 4933 |
|
} |
| 4934 |
|
|
| 4935 |
|
if (self::$support['iconv'] === true) { |
| 4936 |
|
// ignore invalid negative offset to keep compatibility |
|
@@ 5114-5120 (lines=7) @@
|
| 5111 |
|
$encoding = self::normalize_encoding($encoding); |
| 5112 |
|
} |
| 5113 |
|
|
| 5114 |
|
if ( |
| 5115 |
|
$encoding !== 'UTF-8' // INFO: use "mb_"-function (with polyfill) also if we need another encoding |
| 5116 |
|
|| |
| 5117 |
|
self::$support['mbstring'] === true |
| 5118 |
|
) { |
| 5119 |
|
return \mb_strripos($haystack, $needle, $offset, $encoding); |
| 5120 |
|
} |
| 5121 |
|
|
| 5122 |
|
if (self::$support['intl'] === true) { |
| 5123 |
|
$returnTmp = \grapheme_strripos($haystack, $needle, $offset); |
|
@@ 5189-5195 (lines=7) @@
|
| 5186 |
|
$encoding = self::normalize_encoding($encoding); |
| 5187 |
|
} |
| 5188 |
|
|
| 5189 |
|
if ( |
| 5190 |
|
$encoding !== 'UTF-8' // INFO: use "mb_"-function (with polyfill) also if we need another encoding |
| 5191 |
|
|| |
| 5192 |
|
self::$support['mbstring'] === true |
| 5193 |
|
) { |
| 5194 |
|
return \mb_strrpos($haystack, $needle, $offset, $encoding); |
| 5195 |
|
} |
| 5196 |
|
|
| 5197 |
|
if (self::$support['intl'] === true) { |
| 5198 |
|
$returnTmp = \grapheme_strrpos($haystack, $needle, $offset); |
|
@@ 5288-5294 (lines=7) @@
|
| 5285 |
|
self::checkForSupport(); |
| 5286 |
|
} |
| 5287 |
|
|
| 5288 |
|
if ( |
| 5289 |
|
$encoding !== 'UTF-8' // INFO: use "mb_"-function (with polyfill) also if we need another encoding |
| 5290 |
|
|| |
| 5291 |
|
self::$support['mbstring'] === true |
| 5292 |
|
) { |
| 5293 |
|
return \mb_strstr($haystack, $needle, $before_needle, $encoding); |
| 5294 |
|
} |
| 5295 |
|
|
| 5296 |
|
if (self::$support['intl'] === true) { |
| 5297 |
|
return \grapheme_strstr($haystack, $needle, $before_needle); |
|
@@ 5661-5667 (lines=7) @@
|
| 5658 |
|
$haystack = self::clean($haystack); |
| 5659 |
|
} |
| 5660 |
|
|
| 5661 |
|
if ( |
| 5662 |
|
$encoding !== 'UTF-8' // INFO: use "mb_"-function (with polyfill) also if we need another encoding |
| 5663 |
|
|| |
| 5664 |
|
self::$support['mbstring'] === true |
| 5665 |
|
) { |
| 5666 |
|
return \mb_substr_count($haystack, $needle, $encoding); |
| 5667 |
|
} |
| 5668 |
|
|
| 5669 |
|
preg_match_all('/' . preg_quote($needle, '/') . '/us', $haystack, $matches, PREG_SET_ORDER); |
| 5670 |
|
return count($matches); |