|
@@ 5757-5772 (lines=16) @@
|
| 5754 |
|
* |
| 5755 |
|
* @return string|false The portion of haystack or false if needle is not found. |
| 5756 |
|
*/ |
| 5757 |
|
public static function strrchr($haystack, $needle, $before_needle = false, $encoding = 'UTF-8', $cleanUtf8 = false) |
| 5758 |
|
{ |
| 5759 |
|
if ($encoding !== 'UTF-8') { |
| 5760 |
|
$encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5761 |
|
} |
| 5762 |
|
|
| 5763 |
|
if ($cleanUtf8 === true) { |
| 5764 |
|
// "\mb_strpos" and "\iconv_strpos" returns wrong position, |
| 5765 |
|
// if invalid characters are found in $haystack before $needle |
| 5766 |
|
$needle = self::clean($needle); |
| 5767 |
|
$haystack = self::clean($haystack); |
| 5768 |
|
} |
| 5769 |
|
|
| 5770 |
|
// fallback to "mb_"-function via polyfill |
| 5771 |
|
return \mb_strrchr($haystack, $needle, $before_needle, $encoding); |
| 5772 |
|
} |
| 5773 |
|
|
| 5774 |
|
/** |
| 5775 |
|
* Reverses characters order in the string. |
|
@@ 5815-5829 (lines=15) @@
|
| 5812 |
|
* |
| 5813 |
|
* @return string|false <p>The portion of haystack or<br>false if needle is not found.</p> |
| 5814 |
|
*/ |
| 5815 |
|
public static function strrichr($haystack, $needle, $before_needle = false, $encoding = 'UTF-8', $cleanUtf8 = false) |
| 5816 |
|
{ |
| 5817 |
|
if ($encoding !== 'UTF-8') { |
| 5818 |
|
$encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 5819 |
|
} |
| 5820 |
|
|
| 5821 |
|
if ($cleanUtf8 === true) { |
| 5822 |
|
// "\mb_strpos" and "\iconv_strpos" returns wrong position, |
| 5823 |
|
// if invalid characters are found in $haystack before $needle |
| 5824 |
|
$needle = self::clean($needle); |
| 5825 |
|
$haystack = self::clean($haystack); |
| 5826 |
|
} |
| 5827 |
|
|
| 5828 |
|
return \mb_strrichr($haystack, $needle, $before_needle, $encoding); |
| 5829 |
|
} |
| 5830 |
|
|
| 5831 |
|
/** |
| 5832 |
|
* Find position of last occurrence of a case-insensitive string. |