| @@ 28-37 (lines=10) @@ | ||
| 25 | return true; | |
| 26 | } | |
| 27 | ||
| 28 | function starts_with($haystack, $needles): bool | |
| 29 | { | |
| 30 |     foreach ((array) $needles as $needle) { | |
| 31 |         if ($needle != '' && substr($haystack, 0, length($needle)) === (string) $needle) { | |
| 32 | return true; | |
| 33 | } | |
| 34 | } | |
| 35 | ||
| 36 | return false; | |
| 37 | } | |
| 38 | ||
| 39 | /** | |
| 40 | * Determine if a given string ends with a given substring. | |
| @@ 47-56 (lines=10) @@ | ||
| 44 | * | |
| 45 | * @return bool | |
| 46 | */ | |
| 47 | function ends_with(string $haystack, $needles): bool | |
| 48 | { | |
| 49 |     foreach ((array) $needles as $needle) { | |
| 50 |         if ((string) $needle === substr($haystack, -length($needle))) { | |
| 51 | return true; | |
| 52 | } | |
| 53 | } | |
| 54 | ||
| 55 | return false; | |
| 56 | } | |
| 57 | ||
| 58 | /** | |
| 59 | * Returns the portion of string specified by the start and length parameters. | |