|
@@ 4622-4636 (lines=15) @@
|
| 4619 |
|
* |
| 4620 |
|
* @return string|false The portion of haystack or false if needle is not found. |
| 4621 |
|
*/ |
| 4622 |
|
public static function strrchr($haystack, $needle, $before_needle = false, $encoding = 'UTF-8', $cleanUtf8 = false) |
| 4623 |
|
{ |
| 4624 |
|
if ($encoding !== 'UTF-8') { |
| 4625 |
|
$encoding = self::normalize_encoding($encoding); |
| 4626 |
|
} |
| 4627 |
|
|
| 4628 |
|
if ($cleanUtf8 === true) { |
| 4629 |
|
// "\mb_strpos" and "\iconv_strpos" returns wrong position, |
| 4630 |
|
// if invalid characters are found in $haystack before $needle |
| 4631 |
|
$needle = self::clean($needle); |
| 4632 |
|
$haystack = self::clean($haystack); |
| 4633 |
|
} |
| 4634 |
|
|
| 4635 |
|
return \mb_strrchr($haystack, $needle, $before_needle, $encoding); |
| 4636 |
|
} |
| 4637 |
|
|
| 4638 |
|
/** |
| 4639 |
|
* Reverses characters order in the string. |
|
@@ 4679-4693 (lines=15) @@
|
| 4676 |
|
* |
| 4677 |
|
* @return string|false <p>The portion of haystack or<br />false if needle is not found.</p> |
| 4678 |
|
*/ |
| 4679 |
|
public static function strrichr($haystack, $needle, $before_needle = false, $encoding = 'UTF-8', $cleanUtf8 = false) |
| 4680 |
|
{ |
| 4681 |
|
if ($encoding !== 'UTF-8') { |
| 4682 |
|
$encoding = self::normalize_encoding($encoding); |
| 4683 |
|
} |
| 4684 |
|
|
| 4685 |
|
if ($cleanUtf8 === true) { |
| 4686 |
|
// "\mb_strpos" and "\iconv_strpos" returns wrong position, |
| 4687 |
|
// if invalid characters are found in $haystack before $needle |
| 4688 |
|
$needle = self::clean($needle); |
| 4689 |
|
$haystack = self::clean($haystack); |
| 4690 |
|
} |
| 4691 |
|
|
| 4692 |
|
return \mb_strrichr($haystack, $needle, $before_needle, $encoding); |
| 4693 |
|
} |
| 4694 |
|
|
| 4695 |
|
/** |
| 4696 |
|
* Find position of last occurrence of a case-insensitive string. |