| @@ 3953-3967 (lines=15) @@ | ||
| 3950 | * |
|
| 3951 | * @return bool |
|
| 3952 | */ |
|
| 3953 | public static function str_ends_with($haystack, $needle) |
|
| 3954 | { |
|
| 3955 | $haystack = (string)$haystack; |
|
| 3956 | $needle = (string)$needle; |
|
| 3957 | ||
| 3958 | if (!isset($haystack[0], $needle[0])) { |
|
| 3959 | return false; |
|
| 3960 | } |
|
| 3961 | ||
| 3962 | if ($needle === self::substr($haystack, -self::strlen($needle))) { |
|
| 3963 | return true; |
|
| 3964 | } |
|
| 3965 | ||
| 3966 | return false; |
|
| 3967 | } |
|
| 3968 | ||
| 3969 | /** |
|
| 3970 | * Check if the string ends with the given substring, case insensitive. |
|
| @@ 3977-3991 (lines=15) @@ | ||
| 3974 | * |
|
| 3975 | * @return bool |
|
| 3976 | */ |
|
| 3977 | public static function str_iends_with($haystack, $needle) |
|
| 3978 | { |
|
| 3979 | $haystack = (string)$haystack; |
|
| 3980 | $needle = (string)$needle; |
|
| 3981 | ||
| 3982 | if (!isset($haystack[0], $needle[0])) { |
|
| 3983 | return false; |
|
| 3984 | } |
|
| 3985 | ||
| 3986 | if (self::strcasecmp(self::substr($haystack, -self::strlen($needle)), $needle) === 0) { |
|
| 3987 | return true; |
|
| 3988 | } |
|
| 3989 | ||
| 3990 | return false; |
|
| 3991 | } |
|
| 3992 | ||
| 3993 | /** |
|
| 3994 | * Case-insensitive and UTF-8 safe version of <function>str_replace</function>. |
|
| @@ 4045-4059 (lines=15) @@ | ||
| 4042 | * |
|
| 4043 | * @return bool |
|
| 4044 | */ |
|
| 4045 | public static function str_istarts_with($haystack, $needle) |
|
| 4046 | { |
|
| 4047 | $haystack = (string)$haystack; |
|
| 4048 | $needle = (string)$needle; |
|
| 4049 | ||
| 4050 | if (!isset($haystack[0], $needle[0])) { |
|
| 4051 | return false; |
|
| 4052 | } |
|
| 4053 | ||
| 4054 | if (self::stripos($haystack, $needle) === 0) { |
|
| 4055 | return true; |
|
| 4056 | } |
|
| 4057 | ||
| 4058 | return false; |
|
| 4059 | } |
|
| 4060 | ||
| 4061 | /** |
|
| 4062 | * Limit the number of characters in a string, but also after the next word. |
|
| @@ 4311-4325 (lines=15) @@ | ||
| 4308 | * |
|
| 4309 | * @return bool |
|
| 4310 | */ |
|
| 4311 | public static function str_starts_with($haystack, $needle) |
|
| 4312 | { |
|
| 4313 | $haystack = (string)$haystack; |
|
| 4314 | $needle = (string)$needle; |
|
| 4315 | ||
| 4316 | if (!isset($haystack[0], $needle[0])) { |
|
| 4317 | return false; |
|
| 4318 | } |
|
| 4319 | ||
| 4320 | if (self::strpos($haystack, $needle) === 0) { |
|
| 4321 | return true; |
|
| 4322 | } |
|
| 4323 | ||
| 4324 | return false; |
|
| 4325 | } |
|
| 4326 | ||
| 4327 | /** |
|
| 4328 | * Get a binary representation of a specific string. |
|