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
|
@ -68,12 +68,12 @@ if (!function_exists('imagecreatefrombmp')) {
|
|||
if ($BMP['bits_per_pixel'] == 24)
|
||||
$COLOR = unpack("V",substr($IMG,$P,3).$VIDE);
|
||||
elseif ($BMP['bits_per_pixel'] == 16)
|
||||
{
|
||||
{
|
||||
$COLOR = unpack("n",substr($IMG,$P,2));
|
||||
$COLOR[1] = $PALETTE[$COLOR[1]+1];
|
||||
}
|
||||
elseif ($BMP['bits_per_pixel'] == 8)
|
||||
{
|
||||
{
|
||||
$COLOR = unpack("n",$VIDE.substr($IMG,$P,1));
|
||||
$COLOR[1] = $PALETTE[$COLOR[1]+1];
|
||||
}
|
||||
|
@ -185,3 +185,12 @@ if (!function_exists('imagebmp')) {
|
|||
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