| @@ 26-35 (lines=10) @@ | ||
| 23 | return true; |
|
| 24 | } |
|
| 25 | ||
| 26 | function starts_with($haystack, $needles): bool |
|
| 27 | { |
|
| 28 | foreach ((array) $needles as $needle) { |
|
| 29 | if ($needle != '' && mb_strpos($haystack, $needle) === 0) { |
|
| 30 | return true; |
|
| 31 | } |
|
| 32 | } |
|
| 33 | ||
| 34 | return false; |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * Determine if a given string ends with a given substring. |
|
| @@ 90-99 (lines=10) @@ | ||
| 87 | * |
|
| 88 | * @return bool |
|
| 89 | */ |
|
| 90 | function str_contains(string $haystack, $needles): bool |
|
| 91 | { |
|
| 92 | foreach ((array) $needles as $needle) { |
|
| 93 | if ($needle != '' && mb_strpos($haystack, $needle) !== false) { |
|
| 94 | return true; |
|
| 95 | } |
|
| 96 | } |
|
| 97 | ||
| 98 | return false; |
|
| 99 | } |
|
| 100 | ||