parseRangeHeader.php
Table of Contents
Functions
- parseRangeHeader() : array{0: int, 1: int}|false|null
- Parses an HTTP `Range` header into a single satisfiable byte interval.
Functions
parseRangeHeader()
Parses an HTTP `Range` header into a single satisfiable byte interval.
parseRangeHeader(string $rangeHeader, int $fileSize) : array{0: int, 1: int}|false|null
Supports the common single-range forms: bytes=0-499, bytes=500- (open-ended)
and bytes=-500 (suffix / last N bytes). Multi-range requests are intentionally
not honored and resolve to null (the caller should serve the full content).
Parameters
- $rangeHeader : string
-
The raw
Rangeheader value. - $fileSize : int
-
The total size of the file in bytes.
Tags
Return values
array{0: int, 1: int}|false|null —[start, end](inclusive, clamped) for a satisfiable single range →206;falsewhen a range is present but unsatisfiable →416;nullwhen there is no usable single range (absent / malformed / multi-range) → full200.