1
0
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:
Zankaria 2024-11-24 18:46:26 +01:00
parent 2f41f317eb
commit f2b536efe3

10
inc/polyfill.php Normal file
View 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;
}
}