|
@@ 3977-3983 (lines=7) @@
|
| 3974 |
|
*/ |
| 3975 |
|
public static function removeBOM($str = '', $utf8 = true, $utf16 = true, $utf32 = true) |
| 3976 |
|
{ |
| 3977 |
|
if ($utf8 === true) { |
| 3978 |
|
// UTF-8 |
| 3979 |
|
/** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 3980 |
|
if (0 === strpos($str, @pack('CCC', 0xef, 0xbb, 0xbf)) || 0 === strpos($str, '')) { |
| 3981 |
|
$str = substr($str, 3); |
| 3982 |
|
} |
| 3983 |
|
} |
| 3984 |
|
|
| 3985 |
|
if ($utf32 === true) { |
| 3986 |
|
// UTF-32 (BE) |
|
@@ 4002-4004 (lines=3) @@
|
| 3999 |
|
if ($utf16 === true) { |
| 4000 |
|
// UTF-16 (BE) |
| 4001 |
|
/** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 4002 |
|
if (0 === strpos($str, @pack('CC', 0xfe, 0xff)) || 0 === strpos($str, 'þÿ')) { |
| 4003 |
|
$str = substr($str, 2); |
| 4004 |
|
} |
| 4005 |
|
|
| 4006 |
|
// UTF-16 (LE) |
| 4007 |
|
/** @noinspection PhpUsageOfSilenceOperatorInspection */ |
|
@@ 4008-4010 (lines=3) @@
|
| 4005 |
|
|
| 4006 |
|
// UTF-16 (LE) |
| 4007 |
|
/** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 4008 |
|
if (0 === strpos($str, @pack('CC', 0xff, 0xfe)) || 0 === strpos($str, 'ÿþ')) { |
| 4009 |
|
$str = substr($str, 2); |
| 4010 |
|
} |
| 4011 |
|
} |
| 4012 |
|
|
| 4013 |
|
return $str; |