forked from GithubBackups/vichan
polifill.php: add str_starts_with
This commit is contained in:
parent
2f41f317eb
commit
f2b536efe3
10
inc/polyfill.php
Normal file
10
inc/polyfill.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// 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…
x
Reference in New Issue
Block a user