mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-28 01:10:51 +01:00
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…
Reference in New Issue
Block a user