forked from leftypol/leftypol
polifill.php: add str_starts_with
This commit is contained in:
parent
8b586dc3bb
commit
8ad5e4cebd
1 changed files with 11 additions and 2 deletions
|
@ -185,3 +185,12 @@ if (!function_exists('imagebmp')) {
|
||||||
return chr($n & 255).chr(($n >> 8) & 255);
|
return chr($n & 255).chr(($n >> 8) & 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PHP 8.0
|
||||||
|
|
||||||
|
if (!function_exists('str_starts_with')) {
|
||||||
|
function str_starts_with(string $haystack, string $needle): bool {
|
||||||
|
// https://wiki.php.net/rfc/add_str_starts_with_and_ends_with_functions#str_starts_with
|
||||||
|
return \strncmp($haystack, $needle, \strlen($needle)) === 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue