| @@ 4330-4344 (lines=15) @@ | ||
| 4327 | * |
|
| 4328 | * @return bool |
|
| 4329 | */ |
|
| 4330 | public static function str_ends_with($haystack, $needle) |
|
| 4331 | { |
|
| 4332 | $haystack = (string)$haystack; |
|
| 4333 | $needle = (string)$needle; |
|
| 4334 | ||
| 4335 | if (!isset($haystack[0], $needle[0])) { |
|
| 4336 | return false; |
|
| 4337 | } |
|
| 4338 | ||
| 4339 | if ($needle === self::substr($haystack, -self::strlen($needle))) { |
|
| 4340 | return true; |
|
| 4341 | } |
|
| 4342 | ||
| 4343 | return false; |
|
| 4344 | } |
|
| 4345 | ||
| 4346 | /** |
|
| 4347 | * Check if the string ends with the given substring, case insensitive. |
|
| @@ 4354-4368 (lines=15) @@ | ||
| 4351 | * |
|
| 4352 | * @return bool |
|
| 4353 | */ |
|
| 4354 | public static function str_iends_with($haystack, $needle) |
|
| 4355 | { |
|
| 4356 | $haystack = (string)$haystack; |
|
| 4357 | $needle = (string)$needle; |
|
| 4358 | ||
| 4359 | if (!isset($haystack[0], $needle[0])) { |
|
| 4360 | return false; |
|
| 4361 | } |
|
| 4362 | ||
| 4363 | if (self::strcasecmp(self::substr($haystack, -self::strlen($needle)), $needle) === 0) { |
|
| 4364 | return true; |
|
| 4365 | } |
|
| 4366 | ||
| 4367 | return false; |
|
| 4368 | } |
|
| 4369 | ||
| 4370 | /** |
|
| 4371 | * Case-insensitive and UTF-8 safe version of <function>str_replace</function>. |
|
| @@ 4422-4436 (lines=15) @@ | ||
| 4419 | * |
|
| 4420 | * @return bool |
|
| 4421 | */ |
|
| 4422 | public static function str_istarts_with($haystack, $needle) |
|
| 4423 | { |
|
| 4424 | $haystack = (string)$haystack; |
|
| 4425 | $needle = (string)$needle; |
|
| 4426 | ||
| 4427 | if (!isset($haystack[0], $needle[0])) { |
|
| 4428 | return false; |
|
| 4429 | } |
|
| 4430 | ||
| 4431 | if (self::stripos($haystack, $needle) === 0) { |
|
| 4432 | return true; |
|
| 4433 | } |
|
| 4434 | ||
| 4435 | return false; |
|
| 4436 | } |
|
| 4437 | ||
| 4438 | /** |
|
| 4439 | * Limit the number of characters in a string, but also after the next word. |
|
| @@ 4708-4722 (lines=15) @@ | ||
| 4705 | * |
|
| 4706 | * @return bool |
|
| 4707 | */ |
|
| 4708 | public static function str_starts_with($haystack, $needle) |
|
| 4709 | { |
|
| 4710 | $haystack = (string)$haystack; |
|
| 4711 | $needle = (string)$needle; |
|
| 4712 | ||
| 4713 | if (!isset($haystack[0], $needle[0])) { |
|
| 4714 | return false; |
|
| 4715 | } |
|
| 4716 | ||
| 4717 | if (self::strpos($haystack, $needle) === 0) { |
|
| 4718 | return true; |
|
| 4719 | } |
|
| 4720 | ||
| 4721 | return false; |
|
| 4722 | } |
|
| 4723 | ||
| 4724 | /** |
|
| 4725 | * Get a binary representation of a specific string. |
|