|
@@ 5648-5663 (lines=16) @@
|
| 5645 |
|
* |
| 5646 |
|
* @return string|false The portion of haystack or false if needle is not found. |
| 5647 |
|
*/ |
| 5648 |
|
public static function strrchr($haystack, $needle, $before_needle = false, $encoding = 'UTF-8', $cleanUtf8 = false) |
| 5649 |
|
{ |
| 5650 |
|
if ($encoding !== 'UTF-8') { |
| 5651 |
|
$encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5652 |
|
} |
| 5653 |
|
|
| 5654 |
|
if ($cleanUtf8 === true) { |
| 5655 |
|
// "\mb_strpos" and "\iconv_strpos" returns wrong position, |
| 5656 |
|
// if invalid characters are found in $haystack before $needle |
| 5657 |
|
$needle = self::clean($needle); |
| 5658 |
|
$haystack = self::clean($haystack); |
| 5659 |
|
} |
| 5660 |
|
|
| 5661 |
|
// fallback to "mb_"-function via polyfill |
| 5662 |
|
return \mb_strrchr($haystack, $needle, $before_needle, $encoding); |
| 5663 |
|
} |
| 5664 |
|
|
| 5665 |
|
/** |
| 5666 |
|
* Reverses characters order in the string. |
|
@@ 5706-5720 (lines=15) @@
|
| 5703 |
|
* |
| 5704 |
|
* @return string|false <p>The portion of haystack or<br />false if needle is not found.</p> |
| 5705 |
|
*/ |
| 5706 |
|
public static function strrichr($haystack, $needle, $before_needle = false, $encoding = 'UTF-8', $cleanUtf8 = false) |
| 5707 |
|
{ |
| 5708 |
|
if ($encoding !== 'UTF-8') { |
| 5709 |
|
$encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5710 |
|
} |
| 5711 |
|
|
| 5712 |
|
if ($cleanUtf8 === true) { |
| 5713 |
|
// "\mb_strpos" and "\iconv_strpos" returns wrong position, |
| 5714 |
|
// if invalid characters are found in $haystack before $needle |
| 5715 |
|
$needle = self::clean($needle); |
| 5716 |
|
$haystack = self::clean($haystack); |
| 5717 |
|
} |
| 5718 |
|
|
| 5719 |
|
return \mb_strrichr($haystack, $needle, $before_needle, $encoding); |
| 5720 |
|
} |
| 5721 |
|
|
| 5722 |
|
/** |
| 5723 |
|
* Find position of last occurrence of a case-insensitive string. |