2021-10-29 23:06:04 +03:00
|
|
|
<?php
|
2022-07-01 16:10:30 +03:00
|
|
|
|
2021-10-29 23:06:04 +03:00
|
|
|
if (!function_exists('str_starts_with')) {
|
2022-07-01 16:10:30 +03:00
|
|
|
function str_starts_with($haystack, $needle)
|
|
|
|
{
|
|
|
|
return (string)$needle !== '' && strncmp($haystack, $needle, strlen($needle)) === 0;
|
|
|
|
}
|
2021-10-29 23:06:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!function_exists('str_ends_with')) {
|
2022-07-01 16:10:30 +03:00
|
|
|
function str_ends_with($haystack, $needle)
|
|
|
|
{
|
|
|
|
return $needle !== '' && substr($haystack, -strlen($needle)) === (string)$needle;
|
|
|
|
}
|
2021-10-29 23:06:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!function_exists('str_contains')) {
|
2022-07-01 16:10:30 +03:00
|
|
|
function str_contains($haystack, $needle)
|
|
|
|
{
|
|
|
|
return $needle !== '' && mb_strpos($haystack, $needle) !== false;
|
|
|
|
}
|
2021-10-29 23:06:04 +03:00
|
|
|
}
|
2023-09-25 00:07:43 +03:00
|
|
|
|
|
|
|
if (!function_exists('array_is_list')) {
|
|
|
|
function array_is_list(array $arr)
|
|
|
|
{
|
|
|
|
if ($arr === []) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return array_keys($arr) === range(0, count($arr) - 1);
|
|
|
|
}
|
|
|
|
}
|