| @@ 4323-4337 (lines=15) @@ | ||
| 4320 | * |
|
| 4321 | * @return bool |
|
| 4322 | */ |
|
| 4323 | public static function str_ends_with($haystack, $needle) |
|
| 4324 | { |
|
| 4325 | $haystack = (string)$haystack; |
|
| 4326 | $needle = (string)$needle; |
|
| 4327 | ||
| 4328 | if (!isset($haystack[0], $needle[0])) { |
|
| 4329 | return false; |
|
| 4330 | } |
|
| 4331 | ||
| 4332 | if ($needle === self::substr($haystack, -self::strlen($needle))) { |
|
| 4333 | return true; |
|
| 4334 | } |
|
| 4335 | ||
| 4336 | return false; |
|
| 4337 | } |
|
| 4338 | ||
| 4339 | /** |
|
| 4340 | * Check if the string ends with the given substring, case insensitive. |
|
| @@ 4347-4361 (lines=15) @@ | ||
| 4344 | * |
|
| 4345 | * @return bool |
|
| 4346 | */ |
|
| 4347 | public static function str_iends_with($haystack, $needle) |
|
| 4348 | { |
|
| 4349 | $haystack = (string)$haystack; |
|
| 4350 | $needle = (string)$needle; |
|
| 4351 | ||
| 4352 | if (!isset($haystack[0], $needle[0])) { |
|
| 4353 | return false; |
|
| 4354 | } |
|
| 4355 | ||
| 4356 | if (self::strcasecmp(self::substr($haystack, -self::strlen($needle)), $needle) === 0) { |
|
| 4357 | return true; |
|
| 4358 | } |
|
| 4359 | ||
| 4360 | return false; |
|
| 4361 | } |
|
| 4362 | ||
| 4363 | /** |
|
| 4364 | * Case-insensitive and UTF-8 safe version of <function>str_replace</function>. |
|
| @@ 4415-4429 (lines=15) @@ | ||
| 4412 | * |
|
| 4413 | * @return bool |
|
| 4414 | */ |
|
| 4415 | public static function str_istarts_with($haystack, $needle) |
|
| 4416 | { |
|
| 4417 | $haystack = (string)$haystack; |
|
| 4418 | $needle = (string)$needle; |
|
| 4419 | ||
| 4420 | if (!isset($haystack[0], $needle[0])) { |
|
| 4421 | return false; |
|
| 4422 | } |
|
| 4423 | ||
| 4424 | if (self::stripos($haystack, $needle) === 0) { |
|
| 4425 | return true; |
|
| 4426 | } |
|
| 4427 | ||
| 4428 | return false; |
|
| 4429 | } |
|
| 4430 | ||
| 4431 | /** |
|
| 4432 | * Limit the number of characters in a string, but also after the next word. |
|
| @@ 4701-4715 (lines=15) @@ | ||
| 4698 | * |
|
| 4699 | * @return bool |
|
| 4700 | */ |
|
| 4701 | public static function str_starts_with($haystack, $needle) |
|
| 4702 | { |
|
| 4703 | $haystack = (string)$haystack; |
|
| 4704 | $needle = (string)$needle; |
|
| 4705 | ||
| 4706 | if (!isset($haystack[0], $needle[0])) { |
|
| 4707 | return false; |
|
| 4708 | } |
|
| 4709 | ||
| 4710 | if (self::strpos($haystack, $needle) === 0) { |
|
| 4711 | return true; |
|
| 4712 | } |
|
| 4713 | ||
| 4714 | return false; |
|
| 4715 | } |
|
| 4716 | ||
| 4717 | /** |
|
| 4718 | * Get a binary representation of a specific string. |
|