| @@ 4154-4168 (lines=15) @@ | ||
| 4151 | * |
|
| 4152 | * @return bool |
|
| 4153 | */ |
|
| 4154 | public static function str_ends_with($haystack, $needle) |
|
| 4155 | { |
|
| 4156 | $haystack = (string)$haystack; |
|
| 4157 | $needle = (string)$needle; |
|
| 4158 | ||
| 4159 | if (!isset($haystack[0], $needle[0])) { |
|
| 4160 | return false; |
|
| 4161 | } |
|
| 4162 | ||
| 4163 | if ($needle === self::substr($haystack, -self::strlen($needle))) { |
|
| 4164 | return true; |
|
| 4165 | } |
|
| 4166 | ||
| 4167 | return false; |
|
| 4168 | } |
|
| 4169 | ||
| 4170 | /** |
|
| 4171 | * Check if the string ends with the given substring, case insensitive. |
|
| @@ 4178-4192 (lines=15) @@ | ||
| 4175 | * |
|
| 4176 | * @return bool |
|
| 4177 | */ |
|
| 4178 | public static function str_iends_with($haystack, $needle) |
|
| 4179 | { |
|
| 4180 | $haystack = (string)$haystack; |
|
| 4181 | $needle = (string)$needle; |
|
| 4182 | ||
| 4183 | if (!isset($haystack[0], $needle[0])) { |
|
| 4184 | return false; |
|
| 4185 | } |
|
| 4186 | ||
| 4187 | if (self::strcasecmp(self::substr($haystack, -self::strlen($needle)), $needle) === 0) { |
|
| 4188 | return true; |
|
| 4189 | } |
|
| 4190 | ||
| 4191 | return false; |
|
| 4192 | } |
|
| 4193 | ||
| 4194 | /** |
|
| 4195 | * Case-insensitive and UTF-8 safe version of <function>str_replace</function>. |
|
| @@ 4246-4260 (lines=15) @@ | ||
| 4243 | * |
|
| 4244 | * @return bool |
|
| 4245 | */ |
|
| 4246 | public static function str_istarts_with($haystack, $needle) |
|
| 4247 | { |
|
| 4248 | $haystack = (string)$haystack; |
|
| 4249 | $needle = (string)$needle; |
|
| 4250 | ||
| 4251 | if (!isset($haystack[0], $needle[0])) { |
|
| 4252 | return false; |
|
| 4253 | } |
|
| 4254 | ||
| 4255 | if (self::stripos($haystack, $needle) === 0) { |
|
| 4256 | return true; |
|
| 4257 | } |
|
| 4258 | ||
| 4259 | return false; |
|
| 4260 | } |
|
| 4261 | ||
| 4262 | /** |
|
| 4263 | * Limit the number of characters in a string, but also after the next word. |
|
| @@ 4532-4546 (lines=15) @@ | ||
| 4529 | * |
|
| 4530 | * @return bool |
|
| 4531 | */ |
|
| 4532 | public static function str_starts_with($haystack, $needle) |
|
| 4533 | { |
|
| 4534 | $haystack = (string)$haystack; |
|
| 4535 | $needle = (string)$needle; |
|
| 4536 | ||
| 4537 | if (!isset($haystack[0], $needle[0])) { |
|
| 4538 | return false; |
|
| 4539 | } |
|
| 4540 | ||
| 4541 | if (self::strpos($haystack, $needle) === 0) { |
|
| 4542 | return true; |
|
| 4543 | } |
|
| 4544 | ||
| 4545 | return false; |
|
| 4546 | } |
|
| 4547 | ||
| 4548 | /** |
|
| 4549 | * Get a binary representation of a specific string. |
|