| @@ 4020-4034 (lines=15) @@ | ||
| 4017 | * |
|
| 4018 | * @return bool |
|
| 4019 | */ |
|
| 4020 | public static function str_ends_with($haystack, $needle) |
|
| 4021 | { |
|
| 4022 | $haystack = (string)$haystack; |
|
| 4023 | $needle = (string)$needle; |
|
| 4024 | ||
| 4025 | if (!isset($haystack[0], $needle[0])) { |
|
| 4026 | return false; |
|
| 4027 | } |
|
| 4028 | ||
| 4029 | if ($needle === self::substr($haystack, -self::strlen($needle))) { |
|
| 4030 | return true; |
|
| 4031 | } |
|
| 4032 | ||
| 4033 | return false; |
|
| 4034 | } |
|
| 4035 | ||
| 4036 | /** |
|
| 4037 | * Check if the string ends with the given substring, case insensitive. |
|
| @@ 4044-4058 (lines=15) @@ | ||
| 4041 | * |
|
| 4042 | * @return bool |
|
| 4043 | */ |
|
| 4044 | public static function str_iends_with($haystack, $needle) |
|
| 4045 | { |
|
| 4046 | $haystack = (string)$haystack; |
|
| 4047 | $needle = (string)$needle; |
|
| 4048 | ||
| 4049 | if (!isset($haystack[0], $needle[0])) { |
|
| 4050 | return false; |
|
| 4051 | } |
|
| 4052 | ||
| 4053 | if (self::strcasecmp(self::substr($haystack, -self::strlen($needle)), $needle) === 0) { |
|
| 4054 | return true; |
|
| 4055 | } |
|
| 4056 | ||
| 4057 | return false; |
|
| 4058 | } |
|
| 4059 | ||
| 4060 | /** |
|
| 4061 | * Case-insensitive and UTF-8 safe version of <function>str_replace</function>. |
|
| @@ 4112-4126 (lines=15) @@ | ||
| 4109 | * |
|
| 4110 | * @return bool |
|
| 4111 | */ |
|
| 4112 | public static function str_istarts_with($haystack, $needle) |
|
| 4113 | { |
|
| 4114 | $haystack = (string)$haystack; |
|
| 4115 | $needle = (string)$needle; |
|
| 4116 | ||
| 4117 | if (!isset($haystack[0], $needle[0])) { |
|
| 4118 | return false; |
|
| 4119 | } |
|
| 4120 | ||
| 4121 | if (self::stripos($haystack, $needle) === 0) { |
|
| 4122 | return true; |
|
| 4123 | } |
|
| 4124 | ||
| 4125 | return false; |
|
| 4126 | } |
|
| 4127 | ||
| 4128 | /** |
|
| 4129 | * Limit the number of characters in a string, but also after the next word. |
|
| @@ 4378-4392 (lines=15) @@ | ||
| 4375 | * |
|
| 4376 | * @return bool |
|
| 4377 | */ |
|
| 4378 | public static function str_starts_with($haystack, $needle) |
|
| 4379 | { |
|
| 4380 | $haystack = (string)$haystack; |
|
| 4381 | $needle = (string)$needle; |
|
| 4382 | ||
| 4383 | if (!isset($haystack[0], $needle[0])) { |
|
| 4384 | return false; |
|
| 4385 | } |
|
| 4386 | ||
| 4387 | if (self::strpos($haystack, $needle) === 0) { |
|
| 4388 | return true; |
|
| 4389 | } |
|
| 4390 | ||
| 4391 | return false; |
|
| 4392 | } |
|
| 4393 | ||
| 4394 | /** |
|
| 4395 | * Get a binary representation of a specific string. |
|